Also known as TDD Variation for Biz Processes (Test-Driven Business)
The essentials
Sheet 1/4
What it is
What it solves
How do you write code that does what you intend, stays easy to change, and does not quietly break existing behaviour as the system grows?
When to use it
Use it for business logic, algorithms and libraries with clear inputs and outputs, for code that will be maintained for years, and when changing legacy code that needs a safety net first.
Where it comes from
Kent Beck developed TDD out of the test-first practice of Extreme Programming in the late 1990s, after writing the first xUnit framework in Smalltalk. He says he rediscovered the idea from an older programming book, so test-first coding predates him. His book Test Driven Development: By Example was published by Addison-Wesley in November 2002.
Kent Beck · 2002
Sheet 2/4
How it works
Writing the test first forces a precise statement of the next behaviour before any implementation exists, which clarifies intent and the interface. Seeing the test fail proves the test can detect the missing behaviour. Writing only enough code to pass keeps steps small and avoids speculative design. Refactoring under a full green suite lets design improve safely, because any regression shows up within seconds. Over time the tests become executable documentation and a safety net that makes later changes cheaper. Research suggests the small, steady steps matter as much as the test-first ordering.
You need
A clear next behaviour or requirement, a unit-testing framework, a fast test runner, and the discipline to keep steps small.
You get
Working code, a suite of fast automated tests covering each behaviour, and a design shaped into small, testable units.
Sheet 3/4
Case
Illustrative case
Tollgate, a fictional parking-payments startup, must add a pricing rule: first 15 minutes free, then 2.40 per hour, capped at 18 per day. A developer writes a failing test for 10 minutes costing 0, makes it pass, then adds tests for 75 minutes costing 2.40, 9 hours hitting the 18 cap, and a stay crossing midnight. The midnight test exposes a bug in the day boundary before any customer sees it. The feature ships with 14 tests running in under a second; three months later a cap change from 18 to 20 takes 20 minutes and one test update.
A fictional company used to explain the model.
Sheet 4/4
Caution
When to avoid it
It fits poorly with throwaway spikes, exploratory UI layout work, or code dominated by external systems that are hard to isolate.
It is not a replacement for integration, performance, security or exploratory testing.
Common mistakes
Writing tests after the code and calling it TDD.
Taking steps that are too large.
Skipping the refactor step.
Testing implementation details so tests break on every refactor.
Over-using mocks until tests prove nothing about real behaviour.
Known weaknesses
Short-term productivity can drop, especially for teams new to it.
Tests share the developer's misunderstandings of the requirement.
Brittle, over-mocked tests add maintenance cost.
Evidence of quality benefit is modest and context-dependent.
How to apply it in 6 steps
How to apply it
Test-Driven Development
6 steps
01of 6
Step 1 of 6: List behaviours
Write down the scenarios the new feature must handle.
01
02of 6
Step 2 of 6: Write a failing test
Pick one scenario and express it as an automated test.
02
03of 6
Step 3 of 6: Watch it fail
Run the suite and confirm the new test fails for the expected reason.
03
04of 6
Step 4 of 6: Make it pass
Write the simplest code that makes the test and all others pass.
04
05of 6
Step 5 of 6: Refactor
Clean up duplication and design while keeping every test green.
05
06of 6
Step 6 of 6: Repeat
Take the next scenario from the list until the feature is complete.
06
Click to unfold
Use the arrow keys to move between steps, Home and End for the first and last, and Enter to fold or unfold the booklet.
View all 6 steps
01
List behaviours
Write down the scenarios the new feature must handle.
02
Write a failing test
Pick one scenario and express it as an automated test.
03
Watch it fail
Run the suite and confirm the new test fails for the expected reason.
04
Make it pass
Write the simplest code that makes the test and all others pass.
05
Refactor
Clean up duplication and design while keeping every test green.
06
Repeat
Take the next scenario from the list until the feature is complete.
Which decisions it helps with
Decision profile
A phased process to take action.
Keyboard: Tab to the sheet, use the arrows to explore the assessments and their questions, and press Escape to close the note.
IIdentity
Type of tool
Phased processvery likely
The questionWhat kind of tool is it?Assessment · Phased process · 94 %
Decision stage
Plan the work, roles and deadlinesvery likely
The questionWhat stage of the decision are you at?Assessment · Plan the work, roles and deadlines · 85 %
Discipline
Agile and software developmentvery likely
The questionWhich discipline does it come from?Assessment · Agile and software development · 100 %
What it produces
A sequence of phases completed in ordervery likely
The questionWhat kind of tool is it?Assessment · A sequence of phases completed in order · 94 %
IIIResources required
TimeOne session (half a day or a full day)The questionHow much time can you spend on this?Assessment · One session (half a day or a full day) · confidence 0 %
PeopleOne person working aloneThe questionHow many people will take part?Assessment · One person working alone · confidence 91 %
DataNone: experience is enoughThe questionWhat data do you have available?Assessment · None: experience is enough · confidence 48 %
ExpertiseAnyone who has read a page of instructionsThe questionDoes anyone have experience with methods like these?Assessment · Anyone who has read a page of instructions · confidence 41 %
Time horizonDays or weeksThe questionHow far ahead do you need to plan?Assessment · Days or weeks · confidence 66 %
ScopeOne teamThe questionWho will this decision affect?Assessment · One team · confidence 76 %
FrequencyOccasionallyThe questionIs this a one-off decision or something you expect to repeat?Assessment · Occasionally · confidence 31 %
The team’s own knowledge is enoughThe questionCan you speak to customers, users or people outside your organisation?Assessment · The team’s own knowledge is enough
IITen axes
The dot shows which end the model favours. A hollow dot means no clear preference.
DirectionExecutionThe questionAre you setting direction or improving day-to-day operations?Assessment · Execution · confidence 98 %
Top-downBottom-upThe questionShould leadership set the direction, or should the answer come from the people doing the work?Assessment · Bottom-up · confidence 77 %
PeopleProcessesThe questionIs this mainly a people problem or a process problem?Assessment · Processes · confidence 70 %
Generate optionsNarrow down optionsThe questionDo you need to generate more options or narrow them down?Assessment · Mostly narrow down options · confidence 58 %
Step-by-step analysisIntuition and experienceThe questionWould you rather work through the evidence step by step or draw on the group’s experience?Assessment · Step-by-step analysis · confidence 61 %
A strict sequence of stepsA flexible frameworkThe questionWould you prefer a precise set of steps or a framework you can adapt?Assessment · Mostly prescribed steps · confidence 47 %
Protect what we haveTake a riskThe questionDo you need to protect what you have or take a chance on something new?Assessment · Protect what we have · confidence 68 %
Improve what we haveFundamental changeThe questionDo you want to improve what you have or change it fundamentally?Assessment · Mostly incremental improvements · confidence 46 %
Inside the organisationOutside the organisationThe questionWhere do you expect to find the answer, inside your organisation or in the market?Assessment · Inside the organisation · confidence 94 %
Understand firstAct nowThe questionDo you need to understand the situation first or act now and learn as you go?Assessment · Mostly act now · confidence 61 %
IVUseful when
Applicable traits
How it supports actionDecide what comes firstThe questionWhat do you need in order to act?Assessment · Decide what comes first · 100 %
How was this profile calculated?
An automated system reads each model card and answers the same questions for every model. This profile has answers for 77 of 77. No answers are entered by hand.
A very high probability counts as “yes” and a very low one as “no”. Intermediate answers are hidden.
On the axes, mixed means the model favours neither end.
Beck, K. (2002). Test Driven Development: By Example. Addison-Wesley Professional (Addison-Wesley Signature Series).Defining book for TDD. Publisher page shows title, published Nov 8, 2002 by Addison-Wesley Professional, Signature Series (Beck), ISBN-13 978-0-321-14653-3.View source: Test Driven Development: By Example (opens in a new tab) ↗