A scenario can become hard to read when it names a business concept without saying what makes it relevant. A test persona gives that concept a descriptive name; its persona definition specifies the distinctive data needed to illustrate expected behavior. A persona can represent a user, a data structure, or a group of entities. section 17.6 section 17.1
Keep the important detail visible
If a rule depends on ordering five large pizzas, say so in the scenario. Do not hide that quantity inside a named persona: readers need it to understand the expected behavior. section 17.1
Place the definition where readers can use it without losing the scenario’s meaning:
- Define a small persona in its Scenario, or in a feature file’s Background when several scenarios use it. section 17.6
- Store a large or shared definition in an external file or repository, and version it alongside the feature files. section 17.4 section 17.6
- Use a template when similar definitions recur, rather than maintaining a separate full definition for every scenario. section 17.6
Listing 17.11 Scenario that uses realistic traffic data
*** Features/realistic-traffic.csv ***
Date,Pizza,Sales #A
2026-03-09,Truffle Bliss,2540
2026-03-09,Margherita,6850
...
*** Features/Reporting.feature ***
Rule: Weekly report can be generated with daily and by pizza breakdown
Scenario: Weekly sales report provided for a realistic traffic
Given sales traffic from "realistic-traffic.csv" #B
And the restaurant owner is authenticated
When the sales report is requested for the week beginning 2026-03-09
Then the report should show:
"""
* By Pizza
...
"""A weekly-report scenario names a CSV file containing realistic sales traffic instead of embedding its many rows in the feature file. section 17.4
The aim is shared understanding, not merely convenient test setup. Keep details essential to the business rule in the scenario; move bulky supporting data elsewhere without separating it from the specification. section 17.1 section 17.4
