ABSTRACT
Executive summary: Test-driven development (TDD) is a methodology “in the small”—it deals with the work of programmers but does not address a full development life cycle, which includes architecture, design, requirements, and other non-code topics. TDD is typically used as an element of Agile methods, but may in principle be used in conjunction with any method wherein code is developed incrementally. The central concept of TDD is that a test is written before related functional code is developed. Both tests and code are developed in very small increments. Some advocates of this approach view it as, in essence, a specification technique that simply has the side effect of ensuring thorough testing at the function and unit levels. As each test is developed, it is added to the set of all prior tests and the total set is executed against each new increment of functional code. This approach tends to ensure that a new test or a new element of functionality is not only correct in itself but also does not “break” a previous element. TDD requires the availability of suitable automated test tools and assumes each developer writes their own tests. TDD is often combined with a related approach known as Acceptance TDD (ATDD). See also the chapter on extreme programming (XP), which also uses TDD.