February 2018
Intermediate to advanced
406 pages
9h 52m
English
“Where do I begin testing?” is one of the most common questions people have when they start with TDD. Traditionally, my answer is a somewhat glib “start anywhere.” While true, this is less than helpful.
A good option for starting a TDD cycle is to specify the initialization state of the objects or methods under test. Another is the “happy path”—a single representative example of the error-free version of the algorithm. Which starting point you choose depends on how complicated the feature is. In this case it’s sufficiently complex that I’ll start with the initial state and move to the happy path. As a rule of thumb, if it takes more than a couple of steps to define an instance of the application, I’ll start with initialization ...