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:

  1. Red: Write a small test code that will always fail.
  2. Green: Write new code to make the test successful (any ugly code can be allowed in this process).
  3. 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.