Test-driven development (TDD) is an evolutionary approach to development which combines test-first development where we write a test before we write code.
TDD can be defined as a programming practice that instructs developers to write new code only if an automated test has failed. This avoids duplication of code. The primary goal of TDD is to make the code clearer, simple and bug-free. TDD relies on very short development cycle. Once all the tests pass it signals the end of iteration.
If there are more features that needs to be implemented in your product, product will go through the same phases again but this time with new feature set and more tests.
Some Key Points of TDD
- Goal of TDD is specification not validation.
- TDD is both an important agile requirement and agile design technique.
- TDD is related to the test-first programming concept of extreme programming.
- TDD is neither about Testing nor about Design.
- TDD ensures that the source code is thoroughly unit tested and leads to modularised, flexible and extensible code.
- Test-driven development refers to a style of programming in which three activities are tightly interwoven: coding, testing and design.