TDD (Test-Driven Development)
PronunciationTEE-dee-dee
Definition
A software development process where you write a failing automated test before writing the actual implementation code, following a red-green-refactor cycle.
Where you hear it
In team planning sessions, coding pair programming routines, and agile retrospectives.
Examples
We practice TDD to ensure every new feature has automated test coverage from day one.
Writing the test first in TDD helps clarify the requirements before we touch the implementation code.
With TDD, the first commit contains only a failing test for the discount rule.
Common mistake
Thinking TDD is purely a testing technique when it is actually primarily a design technique.
Don't confuse with
TDD is often confused with BDD (Behavior-Driven Development); while TDD focuses on testing individual code units from a developer's perspective, BDD focuses on testing system behavior from a user's perspective using natural language.
Say it at work
- In a meeting or chat
Let's try to use TDD for this new module so we don't end up with a bunch of untested spaghetti code.
- In an email or ticket
I have updated the pull request to include the failing tests, adhering to the TDD approach we agreed upon.
Keep exploring
More in Testing & Quality