
10.3 Testing Techniques 279
technique is known as test-driven development, which assumes you will
proceed in the following fashion:
1. Write a test case.
2. Verify that the test case fails.
3. Modify the code so that the test case succeeds. (The goal is to
write the simplest code you can, without worrying about future
tests or requirements.)
4. Run the test case to verify it now works and run the previous test
cases to verify that the code has not regressed with any newly
introduced defect.
5. Refactor the code to make it pretty.
In the following section we provide an example of how test-driven devel-
opment would proceed for a simple problem.
10.3.6 An Example ...