Tuesday, February 06, 2007

What is Test-Driven Development?

Test-driven development (TDD) is a product development practice in which developers develop tests before they develop the product itself. The purpose of TDD is to drive the design of the product by clearly defining, in the form of pass/fail tests, the criteria by which to judge whether the product satisfies the requirements.

(Developers also employ TDD in developing the internals of the product, including "unit testing" of individual methods and classes in software products, but my focus in this entry is at the system or user acceptance level.)

Developing tests first has several benefits:
  1. It serves as a requirements review. One of the best ways of ensuring that requirements are understandable and testable is to create tests for them.
  2. It forces product designers and developers to understand precisely what goals they are trying to achieve. In translating requirements into executable tests, the developer expresses them in measurable and concrete terms that she readily understands.
  3. It ensures on-going adherence to requirements insofar as developers run the tests regularly.
In an agile product management environment, product managers update the requirements iteratively as development uncovers unanticipated customer needs. Developers update the tests accordingly, and the new tests drive changes in succeeding iterations.

No comments :