Test-Driven Development (TDD)

In Test-Driven Development, the tests are written before the code is developed.
The developer goes through the Red-Green-refactor (clean) stages until the code is finalized:

Red – The written tests initially fail as the code is not written or is incomplete.
Green – The code was written and passed the tests.
Refactor – The developer works on cleaning up and refactoring the working code.