2 ms·
Exactly this. It's Red, Green, Refactor. 1. Write test; build fails because code under test DOESN'T EXIST 2. Write the least amount of code needed for the tes
by tomnipotent 9y ago
Exactly this. It's Red, Green, Refactor.
1. Write test; build fails because code under test DOESN'T EXIST
2. Write the least amount of code needed for the test to pass
3. Refactor & repeat process ad infinitum
The Wikipedia entry for TDD also states this explicitly [0]
This is a differentiating feature of test-driven development versus writing unit
tests after the code is written: it makes the developer focus on the requirements
before writing the code, a subtle but important difference.
[0] https://en.wikipedia.org/wiki/Test-driven_development#Test-driven_development_cycle https://en.wikipedia.org/wiki/Test-driven_development#Test-d...