A When step names the stimulus or event that causes the behavior being specified. The tricky part is deciding which action triggers the outcome and which belongs in the scenario’s context. section 8.6
To choose the When step:
- Identify the action that directly leads to the expected outcome; move other relevant conditions into the Given context. section 8.3.5
- Usually use one When per scenario. Use more only when multiple triggering actions must happen simultaneously. section 8.3.5
Listing 8.4 Single action (contact details)
Given the customer is unauthenticated And they chose to collect their order When they provide contact details unacceptable for customer-collection Then they should be prevented from progressing
Here, the customer’s unauthenticated state and choice of collection form the context; providing unacceptable contact details triggers the refusal. section 8.3.5
