When a scenario mentions several entities of the same kind, readers can lose track of which one a step means. The Introduce and Refer pattern distinguishes a new entity from an existing one by giving them different natural-language phrases. section 13.3
Use the pattern when a scenario follows a particular actor, entity, or concept across multiple steps. This keeps the scenario readable and makes use of its execution context more consistent. section 13.3
Track the order
Introduce an order with “the customer has placed an order.” Later, refer to it as “the order” or “the placed order.” If the customer re-orders an existing order, call the result “the new order” to distinguish it. section 13.3
Table 13.2 Sample step text for introducing and referring to entities in a scenario
|
Introduction
step
|
Refer to it
later as
|
|
Given the customer has placed an order
|
the order, the placed order
|
|
Given the customer is authenticated
|
the customer, the authenticated customer
|
|
When the customer searches for “Margherita”
|
search result
|
|
When the customer selects the first order
|
the order
|
|
Given there is an
existing fulfilled order
|
the order, the existing order, the
fulfilled order
|
|
When the customer re-orders the existing
order
|
the new order
|
Compare introduction phrases with later references for orders, customers, and search results. section 13.3
