Skip to main content
GlossaryTest Design TechniquesTest-Driven Development

Test-Driven Development

Also known as: TDD

Test-Driven Development (TDD) is a development practice where a developer writes a failing automated test before writing the implementation code, then writes just enough code to make it pass, then refactors — repeating in short cycles. Tests drive the design, rather than being added after the fact.

The cycle, often summarized as "red, green, refactor": write a test that fails because the feature doesn't exist yet (red), write the minimal code to make it pass (green), then clean up the implementation while keeping the test passing (refactor) — repeating for the next small piece of behavior.

TDD's real value isn't just "more tests get written" — it's that designing the test first forces a developer to think about a function's interface and behavior before its implementation, which tends to produce more testable, more focused code, and leaves behind a comprehensive regression suite as a natural byproduct rather than an afterthought.

Test-Driven Development — Definition, Example & How It's Used | QA Bash Glossary | QA Bash