liveBook · Manning

Scenario outline

As explained in BDD in Action, Second Edition

A scenario outline is a Gherkin construct that defines a parameterized scenario whose placeholders are replaced with values from an examples table for repeated execution.

A scenario outline defines one parameterized Gherkin scenario and runs it repeatedly with values supplied by an Examples table. It replaces duplicated scenarios with a concise description of a business rule while preserving separate executions for each case. section 7.3.2

Eligibility rules for past flights

A single outline can express flight number, date, status, eligibility, and reason as table columns. Rows such as FH-99 at -60 days, FH-87 at -100 days, and OH-101 at -60 days execute the same steps while exposing different business outcomes. section 7.3.2

Use a scenario outline when related cases share the same behavior structure:

  • Replace repeated scenarios whose differences are data values rather than workflow steps. section 7.3.2
  • Put placeholders such as <Flight>, <Date>, and <Status> in steps, then define their values in Examples rows. section 7.3.2
  • Use rows to explore patterns, boundary conditions, edge cases, and counterexamples to a business rule. section 7.3.2 section 7.6.7
  • Describe observable outcomes precisely rather than turning the outline into vague tester instructions. section 7.6.7

Paying with cash and points

An outline can vary available points and calculate the expected cash charge and remaining balance: 1200 points yields $0 and 200 points remaining; 800 yields $200 and 0; 0 yields $1000 and 0. section 7.6.7

Flight Number

Flight Date

Status

Eligible

Reason

FH-99

60 days ago

COMPLETED

Yes

 

FH-87

100 days ago

COMPLETED

No

Too old

OH-101

60 days ago

COMPLETED

No

Not a Flying High flight

FH-99

60 days ago

CANCELLED

No

Must be completed

FH-99

In 5 days time

CONFIRMED

No

Must have taken place

Compare the flight examples as a compact decision table showing which combinations are eligible and why others fail. section 7.3.2

How BDD in Action, Second Edition covers it

How deep it goes
Explains placeholders, Examples rows, repeated execution, and edge-case exploration, but does not detail step-definition implementation.
Examples
Uses flight-eligibility cases and cash-and-points payment combinations to demonstrate repeated execution across data rows.
What it assumes
Assumes familiarity with Given-When-Then scenarios and tables while reinforcing precise business-rule outcomes from examples.
What you can do after
Apply via Cucumber by writing placeholders, supplying Examples rows, and checking precise outcomes for each case.
How it connects
Connects Gherkin scenarios with Examples tables, acceptance testing, business rules, counterexamples, and living documentation.

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.