With both traditional testing and TDD you aren’t striving for perfection, instead you are testing to match the criticality of the system. A side effect of TDD is that you can achieve 100% coverage for every single line of code, something that traditional testing doesn’t achieve. TDD offers the following benefits:
- More Automated Tests – Ensures that all written code is covered by at least one test.
- Productivity Gain – Programmers that wrote more tests tended to be more productive since there is direct correlation between code and test requirements.
- Client Perspective – By focusing on the test cases first, coders must consider how the functionality will be used by clients.
- Incremental Steps – It allows a programmer to focus on the task at hand as the first goal is to make the test pass.
- Early and Frequent Testing – Catch defects early in the build cycle to prevent them from becoming endemic or more expensive problems down the line.
- Modularized Code – Flexible and extensible code in terms of small units that can be written and tested independently and integrated together later.
- Code Reduction – Because no more code is written than necessary to pass a failing test case, automated tests tend to cover every code path with greater efficiency.