Appendix H. Cheat Sheet

By popular demand, this “cheat sheet” is loosely based on the little recap/summary boxes from the end of each chapter. The idea is to provide a few reminders, and links to the chapters where you can find out more to jog your memory. I hope you find it useful!

The Basic TDD Workflow

  • Double-loop TDD (Figure H-1)

  • Red, Green, Refactor

  • Triangulation

  • The scratchpad

  • “3 Strikes and Refactor”

  • “Working State to Working State”

  • “YAGNI”

A flowchart showing functional tests as the overall cycle, and unit tests helping to code
Figure H-1. The TDD process with functional and unit tests

Relevant chapters: Chapter 4, Chapter 5, Chapter 7

Selenium/Functional Testing Best Practices

  • Use explicit rather than implicit waits, and the interaction/wait pattern.

  • Avoid duplication of test code—helper methods in a base class and the Page pattern are possible solutions.

  • Avoid double-testing functionality. If you have a test that covers a time-consuming process (e.g., login), consider ways of skipping it in other tests (but be aware of unexpected interactions between seemingly unrelated bits of functionality).

  • Look into BDD tools as another way of structuring your FTs.

Relevant chapters: Chapter 21, Chapter 24, Chapter 25