Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
Test driven development (TDD) is an software development approach in which a test is written before writing the code. Once the new code passes the test, it is refactored to an acceptable standard.
TDD ensures that the source code is thoroughly unit tested and leads to modularized, flexible and extensible code. It focuses on writing only the code necessary to pass tests, making the design simple and clear.
TDD enables the programmer to take small steps while writing software. The test is written before testing the functionality and ensures that the application is suitable for testability. Testing on a small amount of code is performed to trap errors that occur in the tested code. Then the functionality is implemented. This is referred to as "red green refactor" where red means fail and green shows a pass. These steps are then repeated. The first goal of a programmer is to focus on the task at hand and to pass it.
The different steps involved in a test driven development cycle are: