METHODOLOGY

BDD

Behavior-Driven Development

Write tests in language the business stakeholder can read. Then make those tests pass.

Last reviewed: byKevin Riedl wiki ↗

Behavior-Driven Development is TDD with the test language rewritten to be readable by non-engineers. Tools like Cucumber use a Given/When/Then format that a product manager can sign off on. The intent is to keep tests aligned with the business behavior they validate, instead of with the implementation that happens to exist today.

Worked example of where this actually pays: an insurance product has a rule that a claim under 30 days old with a valid policy gets auto-approved. Written as a Gherkin scenario (“Given a policy active for 30 days, When a claim is filed within the cover window, Then it is auto-approved”), the product owner and the compliance reviewer can read it, confirm it matches the real rule, and catch the off-by-one before it ships. That shared-language check is the entire value of BDD, and it lives at the acceptance and integration layer where the gap between what product meant and what engineering built is where bugs are born.

There is also a maintenance cost teams discover late. Gherkin scenarios sit on top of a layer of “step definitions”, glue code that maps each plain-English line to actual test actions. That glue is real software that has to be kept in sync as the product changes, and a large BDD suite with sloppy step definitions becomes its own maintenance burden, slow to run and brittle to edit. The benefit (a stakeholder can read and sign off the behaviour) only pays for that overhead when a stakeholder actually reads them. If the Gherkin is written by engineers, read by engineers, and never seen by anyone else, you are paying for a translation layer with no audience.

The honest trade-off and the common mistake: BDD is not a replacement for TDD, it is a layer on top, and applying it everywhere is the error. Writing “Given two numbers, When I add them, Then I get the sum” for a trivial function is ceremony that no business stakeholder will ever read. Save Gherkin for the tests a non-engineer genuinely needs to sign off on, and use plain unit tests below that line. Like all of these practices, BDD is one stage in a sane SDLC and a tool for a real communication problem, not a process to adopt for its own sake.

// FAQ

FAQs

Not either/or. BDD is most useful at the acceptance and integration layer, where engineers and product need a shared language. TDD is useful at the unit-test layer, where the audience is other engineers. Most production teams use both, at different layers.
At the unit-test layer, almost always. Writing ‘Given a user with X, When they do Y, Then Z’ for a function that adds two numbers is ceremony. Save Gherkin for the tests where the business stakeholder actually reads them.