liveBook · Manning

Behavior-driven development

As explained in BDD in Action, Second Edition

BDD is a collection of collaborative practices for discovering business needs and obtaining automated feedback that implemented features meet agreed expectations.

A feature can pass its tests and still fail its users. Requirements handed from stakeholder to analyst to developer to tester create opportunities for assumptions to go unnoticed. Behavior-driven development (BDD) replaces that relay with conversations among business stakeholders, analysts, developers, and testers. Together they identify the business goal, discuss concrete examples of expected behavior, and agree on what would show that a feature works. section 1.1 section 1.5

Repeat the following activities for each feature, rather than treating requirements as a one-time handoff:

  • Find the business goal behind a request. Ask what users need to achieve instead of accepting a proposed solution or trying to fix every requirement up front. section 2.3.1 section 4.2.8
  • Bring users, analysts, developers, and testers into the conversation. Explore examples and counterexamples to expose ambiguity, technical constraints, and questions about testability. section 2.3.2 section 1.5
  • Turn agreed examples into acceptance criteria. A scenario can state a context, an action, and an expected outcome using Given, When, and Then. section 3.4
  • Where useful, automate those scenarios as business-readable executable specifications. Work from the acceptance criteria toward the code, using low-level specifications or unit tests to describe component behavior. section 2.3.7 section 2.6
  • Run the automated checks for feedback and use their results as living documentation of delivered behavior. Return to conversation when examples reveal a mistaken assumption or a changing need. section 2.3 section 2.4.3

An example changes the requirement

Suppose a commuter asks for the next train from Hornsby to Chatswood. An initial scenario says only that the next train leaves at 8:02. Reading it together reveals a missing condition: more than one line departs from Hornsby, so the scenario must identify the line going to Chatswood. Further examples distinguish returning one departure from showing several suitable departures. The conversation makes the acceptance criterion more precise before implementation. section 3.4

BDD is a collection of practices, not a replacement for Scrum or Kanban and not merely a test-writing syntax. It extends ideas from test-driven development to business-facing requirements discovery while also applying behavior-focused thinking to unit tests. Its benefits depend on timely stakeholder participation: automated checks cannot recover business intent that the team never discussed. section 1.3 section 2.5.1 section 2.6

How BDD in Action, Second Edition covers it

How deep it goes
Works through goal discovery, collaborative examples, scenarios, acceptance automation, and outside-in implementation; the introductory walkthrough defers a full technology-stack example.
Examples
Uses train-departure scenarios and password-strength examples to uncover missing conditions and sharpen acceptance criteria.
What it assumes
Assumes a software-delivery team and stakeholder access, while distinguishing unit tests from business-facing acceptance tests before applying them.
What you can do after
Practice/perform collaborative feature discovery, formulate executable acceptance criteria, and use automated checks to guide implementation and reduce regression risk.
How it connects
Connects user stories, acceptance criteria, executable specifications, unit tests, living documentation, test-driven development, Scrum, and Kanban.

Also explained in

Compare how 4 books explain behavior-driven development →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of BDD in Action, Second Edition. The section links point to the parts of the book it draws on.