liveBook · Manning

Example

As explained in Effective Behavior-Driven Development

A concrete instance illustrating an expected behavior or a possible outcome of a rule.

“Customers can change a delivery address after ordering” sounds clear—until someone asks whether that still applies when a driver has picked up the order. An example puts the rule into one specific situation so the team can agree on the expected behavior. It illustrates a rule; it does not replace the rule. section 2.4 section 3.5

A useful example has three parts: context, the system’s starting state; action, the event that triggers behavior; and outcome, the state to check afterward. Starting with the desired outcome and working backward can help identify the necessary context. section 3.1 section 3.7

Changing an address before pickup

Context: An order is waiting for pickup. Action: The customer submits a new delivery address. Outcome: The address change is accepted. This makes the boundary of the rule discussable: what should happen once the order has been picked up? section 3.3 section 1.3.2

Figure 3.1 Anatomy of an example

The diagram shows the three parts to check when turning a situation into a concrete example. section 3.1

Keep examples useful in a requirements conversation:

  • Give enough specific detail to distinguish the intended behavior, but omit unrelated data, such as pizza choice when checking an address change. section 3.1 section 3.2
  • Begin with an ordinary successful case, then ask for counterexamples, different outcomes, and boundary cases. Use disagreements to refine the rule or record an unanswered question. section 2.6.6 section 2.4
  • Focus each example on one rule, even if successful behavior depends on other rules. Capture both the rule and its examples. section 3.6 section 3.5

In Example Mapping, examples sit beneath rules for a user story. Their immediate purpose is shared understanding, not exhaustive testing. Stop adding workshop examples when they no longer reveal anything about the desired behavior. Later, useful examples can become business-readable scenarios and automated checks; others may be merged or left unformulated without losing what the conversation taught. section 2.5 section 3.4 section 9.7

How Effective Behavior-Driven Development covers it

How deep it goes
Defines context, action, and outcome, then addresses precision, relevant detail, rule focus, and when to stop collecting examples.
Examples
Uses delivery-address changes before and after order pickup to expose ambiguity and distinguish accepted from rejected requests.
What it assumes
Introduces the three-part structure from first principles while placing examples within user stories and rules.
What you can do after
Practice/perform collaborative discovery by writing focused context–action–outcome examples that clarify rules without attempting exhaustive test coverage.
How it connects
Connects examples to user stories, business rules, Example Mapping, scenarios, and automated tests.

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.