Test Driven Development is a development practice that is also part of XP (eXtreme Programming). At its core, TDD is describes a very short development cycle:
- Red: Write a test case that specifies a new requirement (this test will fail until the requirement is implemented)
- Green: Write code to implement the requirement and make the test pass
- Refactor: Improve the design of the existing code without changing its behavior or fulfilling further requirements (keeping all existing tests green)
This cycle is repeated over and over again to build a system that grows in small increments and can be used for continuous feedback.
TDD can be applied at different levels, such as system units (specifying and testing the design of the system) or higher. Acceptance Test Driven Development is a form of TDD where the test case (step 1) describes an acceptance criteria required by the business. Teams often apply a combination of TDD and ATDD.