Let’s walk through an example in detail. This example illustrates how to create the right kind and number of tests for a specific behavior to drive the development of that behavior.
If you’re not a programmer and you don’t read source code, don’t worry. You should be able to understand the gist of what the code is doing if I’ve named things well. Even if you don’t understand exactly how this code works, you’ll certainly get a sense of many things developers must consider when building software.
Let’s say I want to create a Person class that has a name and an age. I am programming in Java using the Eclipse development environment.
I start by writing a test for the happy path: