Test-Driven Design (TDD), as might be expected from its name, is focused first and foremost on using automated tests of a code base to direct development efforts. The overall process breaks down into the following steps:
- For each functionality goal (new or enhanced feature) being implemented:
- Write a new test or set of tests that will fail until the code being tested meets whatever contract and expectations are being tested.
- Assure that the new test(s) fail, as expected, for the reasons expected, and don't raise any other failures.
- Write code that passes the new test(s). It may be horribly kludgy and inelegant initially, but this doesn't matter as long as it meets the requirements embedded in the test(s).
- Refine and/or ...