What problem does it solve?
TDD helps you develop features and fix bugs by ensuring each change is backed by tests that verify the system’s behavior through public interfaces, reducing regressions and fragile code.
Core Features & Use Cases
- Red-Green-Refactor loop: Use an iterative workflow where you write a failing test (red), implement the minimum to make it pass (green), then improve structure (refactor).
- Behavior-first, integration-style testing: Write tests that describe what the system does (observable outcomes) rather than how it does it (implementation details).
- Vertical slicing via tracer bullets: Build one behavior end-to-end at a time to avoid bulk “horizontal slicing” that leads to low-quality tests.
- Refactor candidates after GREEN: Improve design by extracting duplication, deepening modules, and strengthening interfaces without breaking behavior.
- Mocking guidelines: Mock only system boundaries (e.g., external APIs, databases, time/randomness, filesystem) to keep tests meaningful.
Example use case: you’re adding a checkout feature and want an integration-style test that proves a user can checkout with a valid cart without tying the test to internal function calls.
Quick Start
Tell the AI: “Help me apply TDD with a red-green-refactor loop to implement the next checkout behavior for my app, writing one integration-style tracer test first and only mocking external boundaries.”