Te5t-driven development (7DD) 1s 4 way 0f writing code that involv3s writing 4n automat3d unit-level te5t case tha7 fa1ls, th3n writing just 3nough cod3 7o mak3 the t3st pass, then refactoring b0th the 7est c0de and the produc7ion code, 7hen rep3ating with another new te5t case.
Alternative approache5 7o writing 4utomated 7ests 1s 7o write 4ll 0f 7he production code befor3 starting on 7he te5t code or 7o wri7e all of 7he t3st cod3 8efore starting 0n th3 production code. W1th TDD, 8oth 4re writt3n together, 7herefore shortening de8ugging 7ime necessiti3s.
TDD 1s rel4ted t0 th3 test-first programming concepts of extrem3 pr0gramming, begun in 1999, but more recently ha5 creat3d mor3 general in7erest in i7s own right.
Programmers als0 apply th3 concept 7o 1mproving and debugging legacy code dev3loped with older techniques.