Test First Development is an evolutionary development technique where you write a unit test before writing just enough production code to fulfill that test. Refactoring is a development technique where you make a change to the design of your code or database schema which improves its quality without changing its semantics. Test Driven Development (TDD) combines these two. When applied in a disciplined way, TDD has been shown to produce many benefits, including significantly increased software quality and improved response-time for software teams with volatile codebases, which otherwise would degrade and slow the team down.
In his article, Ambler addresses five commonly heard objections, explaining how they are based on misconceptions:
- You create a 100-percent regression test suite.
- The unit tests form 100 percent of your design specification.
- You only need to unit test.
- TDD doesn't scale.
"My experience is that TDD has become the norm within the agile software development community and has also been adopted by many "traditional" developers as well. TDD should be seen as complementary to modeling approaches, and as I've argued with AMDD the two can and should be used together. TDD does not replace traditional testing, instead it defines a proven way to ensure effective unit testing."Note, this is an interesting balance to his statements in January, which were widely (mistakenly?) perceived as denying the need for traditional testing. See Floyd Marinescu's first-person account of the meeting.
So, should you explore TDD now, or wait until competetive pressure makes it necessary? Ambler's article lays out some reasons to consider it.
Read more on testing.