Web apps & software

What is behavior-driven development (BDD)?

Behavior-driven development, or BDD, describes what software should do as plain-language examples in Given, When, Then form, which the whole team can read and which tools can also run as automated tests.

A scenario

Given a passenger has a prepaid wallet with 10 units of credit, when they book a ride estimated at 12 units, then the booking is rejected and the app suggests topping up. Business staff, testers and developers agree on this wording before code is written, so misunderstandings come out early.

Tools

Cucumber, SpecFlow, Behave and Gauge turn these Gherkin scenarios into tests by linking each line to code.

Where it helps

Products with complicated business rules, many stakeholders and costly misunderstandings, such as insurance, billing or dispatch. It gives acceptance criteria a precise, testable form.

Where it does not

If the business people never read or write the scenarios, BDD is just extra ceremony around ordinary tests. Long scenarios that click through screens become slow and brittle.

Use it for rules; write plain unit tests for technical details.

Questions, answered

The simple keyword-based language, with Given, When and Then, used to write BDD scenarios.

A product owner, tester and developer together, sometimes called the three amigos.

By the Stegnor team · Updated