liveBook · Manning

Behavior-driven development

As explained in Effective Behavior-Driven Development

An activity that applies behavior-driven development principles during software development.

A team can deliver working software and still discover that it misunderstood what the business needed. Behavior-driven development (BDD) addresses that gap by bringing business stakeholders and the delivery team together around concrete examples of expected behavior. Those examples become business-readable scenarios that guide implementation and, when automated, check that the software continues to behave as agreed. BDD uses tests, but it is not primarily a testing technique. section 1.0 section 1.3

For each user story, three practices carry an idea toward working software:

  • Discovery: business, development, and test perspectives discuss rules and concrete examples. This exposes ambiguity before code is written. section 1.3 section 4.1
  • Formulation: the team turns selected examples into scenarios using language stakeholders can review. Stakeholder review checks whether the team understood the requirement. section 1.3 section 4.8
  • Automation: the team makes a scenario executable, sees it fail, and implements enough behavior to make it pass. Repeated runs check the implementation against the documented behavior. section 1.3 section 4.8

Changing a delivery address

Suppose a customer wants to change an order’s delivery address after placing it. “Allow address changes” sounds clear until the team asks whether the order’s status matters and whether the new address can be too far from the original one. A short Example Mapping conversation captures candidate rules, concrete examples, and unanswered questions. The team can resolve those questions before choosing scenarios to implement. section 2.2

The wider delivery flow also includes choosing a story, reviewing scenarios, implementing production code, supplementary testing, and release. Passing automated scenarios does not eliminate other testing. BDD can fit Scrum and other processes, but the timing and responsibilities should be adapted to the team rather than treated as a fixed checklist. section 4.8 section 4.0

Scenarios preserve a link between stakeholder intent, implementation, and documentation. When they run as tests, they can reveal a later divergence between the agreed behavior and the software. In regulated work, versioned scenarios and execution reports can also support traceability, though further documentation may still be required. section 1.3.6 section 4.7

Using Gherkin or Cucumber to test functionality after it has been built is not, by itself, BDD: discovery and formulation must help drive the new implementation. On a legacy project, documenting existing behavior can still make changes safer; the team can then use the behavior-driven flow for new behavior. Adoption depends on real stakeholder availability, scenario review, and attention to code quality—not merely new terminology or tools. section 11.1 section 1.6.4

How Effective Behavior-Driven Development covers it

How deep it goes
Details discovery, formulation, automation, and the surrounding delivery activities; leaves initial story gathering outside its scope.
Examples
Uses a delivery-address change story to surface questions about order status and how far an address may change.
What it assumes
Assumes stakeholders can supply candidate stories and rules; teaches how a team develops them into agreed, executable behavior.
What you can do after
Practice/perform discovery, scenario review, and automation to guide new behavior and detect divergence from agreed expectations.
How it connects
Links user stories, Example Mapping, business-readable scenarios, test-driven development, living documentation, and supplementary testing.

Also explained in

Compare how 8 books explain behavior-driven development →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Effective Behavior-Driven Development. The section links point to the parts of the book it draws on.