Test-Driven Development Key Concepts
Table of Contents
The simple and powerful key concepts of test-driven development (TDD) are following:
- Write new code only if automatic tests have failed
 - Delete duplication
 
These concepts lead to the following procedures:
- Red: Write a small test code that will always fail.
 - Green: Write new code to make the test successful (any ugly code can be allowed in this process).
 - Refactor: Remove all of duplications and improve code quality.
 
Red, green and refactor are also core principles in test-driven development.
“Clean code that works, in Ron Jeffries’ pithy phrase, is the goal of Test-Driven Development (TDD). Clean code that works is a worthwhile goal for a whole bunch of reasons."
Kent Beck, Test-Driven Development by Example.