liveBook · Manning

Examples table

As explained in BDD in Action, Second Edition

An example table is a tabular Gherkin data structure whose rows supply parameter values for repeated scenario executions.

An examples table is a tabular Gherkin data structure attached to a Scenario Outline. Each row supplies values for angle-bracket placeholders, causing the scenario to run once per row. section 2.3.5 section 7.3.2

Use an examples table to:

  • Replace several nearly identical scenarios with one readable template and a table of cases. section 7.3.2
  • Make patterns, boundary conditions, and edge cases easier to compare. section 7.3.2
  • Turn business-rule examples into executable scenarios and living documentation. section 7.3.2

Interest calculation

A Scenario Outline can place <account-type>, <initial-balance>, <interest>, <earnings>, and <new-balance> in its steps. An Examples table then runs the same behavior for Current, Savings, and SuperSaver accounts. section 2.3.5

Listing 7.2 Scenarios expressed as a scenario outline
Scenario Outline: Eligible flights in the past 90 days can be claimed.      #1
  Given Todd has just joined the Frequent Flyer program                     #2
  And Todd asks for the following flight to be credited to his account:.    #2
    | Flight Number   | Flight Date | Status   |                            #2
    | <Flight>        | < Date>     | <Status> |                            #2
  Then the flight should be considered <Eligibility>
  Examples:                                                                 #3
    | Flight | Date     | Status    | Eligibility | Reason             |    #4
    | FH-99  | -60 days | COMPLETED | Eligible    |                    |    #4
    | FH-87  | -100 days| COMPLETED | Ineligible  | Too old            |    #4
    | OH-101 | -60 days | COMPLETED | Ineligible  | Different airline  |    #4
    | FH-99  | -60 days | CANCELLED | Ineligible  | Must be completed  |    #4
    | FH-99  | +5 days  | CONFIRMED | Ineligible  | Hasn’t taken place |    #4

Compare repeated flight-eligibility scenarios with their compact Scenario Outline and Examples table. section 7.3.2

How BDD in Action, Second Edition covers it

How deep it goes
Explains placeholders, row-by-row execution, and communication benefits, while deferring detailed step-table notation.
Examples
Uses interest calculations, flight-eligibility cases, and repeated account or points data to demonstrate tabular inputs.
What it assumes
Assumes familiarity with Given–When–Then scenarios and teaches placeholder substitution through concrete tables.
What you can do after
Apply it via Cucumber to express repeated cases as one Scenario Outline with data-driven executions.
How it connects
Connects Scenario Outline, Gherkin, executable specifications, boundary conditions, edge cases, 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.