Operations · Operations & process management
Behavior-driven development (BDD)
Use it when
Product people, developers and testers keep disagreeing about what a feature should do, and you want agreed examples that also run as automated tests.
Skip it when
- Only developers need to agree the behavior of single classes or functions. Use Test-driven development (TDD), which this builds on.
- The work is not yet broken into small user stories. Write them with User story framework first.
- Nobody on the team can say what the right outcome is for most cases. Get the answers from users or a short spike before you hold a session.
What to apply first and what to use instead are listed below.
Inputs
- Upcoming user storyOne small change with any acceptance criteria already known, from the top of the backlog, due in the next iteration.
- Three amigosAt least a product person, a developer and a tester, plus anyone who can answer the story's questions, for a session of about 25 minutes.
- Cards or a shared boardFour colors for the story, its rules, its examples and open questions.
- Scenario runnerA tool set up in the project that runs given, when, then scenarios against the system, such as Cucumber.
- Domain termsOptionalThe business's own words for the things in the story, from earlier scenarios or a glossary.
Steps
- Hold a discovery session on one story, writing each rule on its own card, concrete examples under each rule, and questions nobody present can answer on separate cards.
- Decide at the end of the session whether the story is ready, should be split, or needs its questions answered first.
- Write each agreed example as a scenario in given, when, then form using the business's terms, and have the product person review the wording.
- Connect each scenario's steps to the system as an automated test, run it, and watch it fail.
- Build the behavior, using test-first cycles for the internal parts, until the scenario passes.
- Keep the passing scenarios in the suite as living documentation, and rewrite or delete a scenario when its business rule changes.
Output
A feature file of agreed scenarios for the story, all passing in the automated suite, with a list of deferred stories and open questions.
- Story
- Rules
- Scenario for each example (given, when, then)
- Automation status (failing or passing)
- Open questions with owner
- Stories split off and deferred
Done when
- Every rule has at least one example, or a note that the group agreed none was needed.
- Every open question has an owner, and is answered or agreed as minor before the story enters development.
- Every scenario describes one event in the business's own terms.
- The product person has reviewed the wording of every scenario.
- Every scenario runs in the automated suite and passes.
Measure
For three to six iterations after you start, track rework on stories after review, defects found after release, and stories sent back for clarification during development. Compare each with the same measures from the iterations before you started. It worked when all three fall, and the suite catches regressions before release.
Hypothetical example
A team at Ferro Bank took the story "As a cardholder, I want to freeze my card so that no one can use it if I lose it." In a 25-minute session they wrote three rules. A frozen card declines new payments, a frozen card still accepts refunds, and only the cardholder can unfreeze it. Each rule got one or two examples, such as the one where a refund arrives on a frozen card. One question card asked whether subscriptions should still be charged, and the product owner took it away. The developer and tester wrote five scenarios in the bank's terms, the product owner approved them, and all five ran red, then green, before the story closed.
Common mistakes
- Typing formal scenarios into a tool during the discovery session. Capture rough examples on cards first and write the scenarios afterwards.
- Writing scenarios in technical terms only developers use. Use the business's words so the product person can check them.
- Letting the group argue over an outcome nobody knows. Write it on a question card with an owner and move on.
- Pulling a story covered in rule cards into development. Split it and defer the less important part.
- Keeping a failing scenario whose premise has changed. Rewrite or delete it when the business rule has changed.
Sources
- Introducing BDD · Dan North, 2006
- Behaviour-Driven Development · Cucumber, 2026
- Introducing Example Mapping · Matt Wynne, 2015
By company stage
Apply first
- Test-driven development (TDD)Operations · Operations & process management
BDD grew out of TDD, adding business-readable given-when-then specifications to the test-first cycle; the red-green-refactor practice comes first.
Use instead
- Test-driven development (TDD)
Only developers need to agree the behavior of single classes or functions. Use Test-driven development (TDD), which this builds on.
- User story framework
The work is not yet broken into small user stories. Write them with User story framework first.
Where it sits
Open the operations & process management roadmapRecommended resources
No sponsored resources on this framework yet. Sponsored listings would be labelled here, never in search.
Progress is not saved until you have an account. Create a free account