What problem does it solve?
Test-Driven Development prevents bugs and regressions by forcing you to define the expected behavior with a failing test before writing production code.
Core Features & Use Cases
- Failing-test-first workflow: Write a minimal test, verify it fails for the right reason, implement the smallest code change to pass, then re-verify it passes.
- TDD cycle discipline: Repeat red-green-refactor while keeping tests green and avoiding accidental feature creep.
- Anti-pattern prevention: Actively discourages mock-only assertions, test-only production methods, incomplete mocking, and “tests after” as proof.
- Use Case: When fixing a bug (e.g., “empty email is accepted”), write a test that demonstrates the incorrect behavior, watch it fail, implement the minimal fix, and confirm the test passes while guarding against future regressions.
Quick Start
Use test-driven-development when implementing or changing any behavior—write a failing test first, implement minimal code to make it pass, and only then refactor.