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
