Test Driven Development:
Basic Idea
The idea is to meet requirements incrementally and always have working code.
This is called the “Red-Green-Refactor” cycle
Benefits of
Test Driven Development
Test Driven Development:
Three Laws
DO NOT write production code until you have written failing unit tests
DO NOT write more of a unit than is sufficient to fail
DO NOT write more production code than is sufficient to pass the currently failing test
Test Driven Development:
Most Important Rule
DO NOT
Write code in your head
BEFORE
You write the TEST
Test Driven Development
Cycle
Write Test Code (Red)
Write Functional Code (Green)
Refactor
TDD Cycle:
Write Test Code (Red) Phase
Purpose and Benefits
TDD Cycle:
Write Functional Code (Green) Phase
Purpose and Benefits
TDD Cycle:
Refactor Phase
Purpose and Benefits