the development process by focusing on only making
changes or adding code that satisfies the goal of the test.
In normal testing, you test after the software is written,
which means you spend your time chasing errors and
bugs more than writing code. By writing the test first,
you spend your time focused on writing only what is
needed and making your code simple, easier to
understand, and hopefully bug free. Figure 5-1 shows the
TDD process in action.
Figure 5-1 Test-Driven Development in Action
The following are the five steps of TDD:
Step 1. Write a test: Write a test that tests for the
new class or function that you want to add to
your code. Think about the class name and
structure you will need in order to call the new
capability that doesn’t exist yet—and nothing
more.