TDD — write tests first. BDD — write behavior specs first.
Test-Driven Development (TDD):
TDD Cycle:
1. Write failing test (Red)
2. Write minimal code (Green)
3. Refactor
(Repeat)
Behavior-Driven Development (BDD):
BDD Spec:
Given a logged-in user
When they add an item to cart
Then the cart total updates
(Behavior-focused)
Key differences: