A Gherkin test describes expected behavior as a user-focused scenario. Its Given–When–Then structure states the initial conditions, an action, and the expected outcome. Testers and developers can use this shared vocabulary to agree on behavior before turning scenarios into executable tests. section 6.2
Listing 6.1 The BDD approach — sending a message described as a Gherkin scenario
Feature: Real-time message delivery
Scenario: A message reaches another member live
Given Ada and Grace are both viewing the "general" channel
When Ada sends a message "deployment is green"
Then Grace sees "deployment is green" without reloading
This scenario specifies live message delivery without prescribing how it is implemented. section 6.2
Write and review scenarios before building a feature. Check whether they capture the intended behavior, including edge cases and missing scenarios. AI can draft the files, but a person should iterate on them and explicitly approve them before implementation starts. section 6.2 section 6.6
For each manageable feature slice:
- Write the .feature scenarios, then stop and wait for approval. Revise them when the expected behavior needs clarification. section 6.6
- Run the scenarios and check that they fail for the right reason, such as a missing step or endpoint, rather than a broken test harness. section 6.6
- Build until the scenarios pass; fix the implementation rather than changing a scenario to fit it. section 6.6
- Deploy the slice, run its unit tests and BDD suite, and use the scenarios to guide exploratory testing. section 6.11
