Skip to content

Test-Driven Development (TDD) Workflow

TDD is a workflow:

  1. write a failing test (Red)
  2. write minimal code to pass (Green)
  3. refactor safely (Refactor)
diagram Diagram mermaid
  • forces clarity on requirements
  • encourages smaller functions
  • reduces fear of refactoring

TDD is easiest for:

  • pure functions
  • business rules

Harder for:

  • UI code
  • code with many external integrations

In those cases, combine TDD with integration tests.

pch.coffeeTagline

pch.coffeeCta

pch.feedbackHeading

pch.feedbackSubheading