agile3
Engineering Practices

Behavior Driven Development (BDD)

Describing software behaviour in plain-language examples that business and developers both understand, then automating them.

2 min read · Practitioner

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

  1. Discovery: talk through examples together.
  2. Formulation: write them in a structured, readable format.
  3. 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.

Spec-Driven Development →

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.