In 30 seconds
- Behaviour is described as concrete examples in shared language.
- Given, When, Then is the common format.
- The examples become living, automated documentation.
The format
Given a customer with a saved card, when they check out, then the saved card is selected by default.
Dan North introduced BDD in the mid-2000s to make test-first development easier to explain and to involve the business.
Three practices
- Discovery: talk through examples together.
- Formulation: write them in a structured, readable format.
- Automation: connect them to code with tools like Cucumber.
Common pitfalls
- Writing scenarios after the code, which loses the conversation
- Scenarios full of UI clicks instead of business behaviour
- Huge scenario suites nobody reads
Compare with TDD on TDD vs BDD.
Myth vs reality
Myth · BDD is a tool.
Reality · It's a collaboration practice; tools are optional.
Myth · BDD replaces unit tests.
Reality · It covers behaviour; unit tests cover code design.
Myth · Only testers write scenarios.
Reality · The whole team, with the business, writes them.
The AI angle
Given-When-Then scenarios make excellent specifications for AI-generated code: readable by people, precise enough for tools, and automatable as checks.
FAQ
What is Gherkin?
The structured language used by Cucumber for Given-When-Then scenarios.
How many scenarios per story?
A handful of key examples, not every combination.
Is BDD the same as ATDD?
Very similar; BDD adds a specific language and focus on behaviour.