Khaos

Test-Driven Development

TDD (test-driven development) advocates say this approach has two major benefits.
First, because the tests embody specific uses of the yet-unwritten software, they will help tease out the design of the software, complementary to other techniques such as requirements specification and modeling. Second, the tests create a safety net, enabling the programmer to engage in the risky but necessary practice of refactoring — continuously reorganizing the code — without fear of breakage. One of XP’s tenets is that change is the only constant. As the business environment evolves, so do the requirements it imposes on software. Although software is in theory perfectly malleable, in practice we are often afraid to change it. TDD seeks to reduce that fear by controlling the risk associated with change.

– Jon Udel, Test before you leap into development