Test Driven Development (TDD) - Red-Green Refactor - Test-First Programming
Created on · Last Modified on
Test-driven development (TDD) - Red-Green Refactor - Test-First Programming
is a technique for building software that guides software development by writing tests
is a software development process relying on software requirements being converted to test cases before software is fully developed, and tracking all software development by repeatedly testing the software against all test cases
was developed by Kent Beck in the late 1990’s as part of Extreme Programming (XP)
TDD - Steps
Write a test for the next bit of functionality you want to add
Write the functional code until the test passes
Refactor both new and old code to make it well structured
TDD - Benefits
it’s a way to get SelfTestingCode, since you can only write some functional code in response to making a test pass
thinking about the test first forces you to think about the interface to the code first. This focus on interface and how you use a class helps you separate interface from implementation