Given, When, Then acceptance criteria
Last reviewed November 8, 2026
Given, When, Then is a way of writing acceptance criteria as short scenarios. Given describes the situation before, When describes what the user does, and Then describes the result that should follow. Each scenario is one concrete example of the story working, or failing safely. The format comes from behavior-driven development, and tools such as Cucumber can run scenarios written this way as automated tests. For acceptance criteria in general, see Acceptance criteria.
The strength of the format is that it forces examples. "The discount works" is vague. "Given a basket of 60, when the customer enters SAVE10, then the total is 54" isn't.
When to use it
- Stories with rules, such as prices, limits, permissions or dates.
- Stories where people disagree about what should happen. Writing examples brings out the disagreement early.
- Teams that automate tests, because scenarios can become tests.
A plain checklist is often enough for simple stories, such as changing a label.
The template
Rules for good scenarios
- One behavior per scenario. If a scenario has two Whens, it is probably two scenarios.
- Describe what, not how. "When the customer pays" rather than "When the customer clicks the blue button in the top corner".
- Use real values. Numbers, dates and names make scenarios testable.
- Cover the edges. The normal case, the boundaries, and what happens when something goes wrong.
- Keep it readable. The Product Owner and stakeholders should understand every scenario without help.
A complete example
An examples table
When one rule applies to many values, a table keeps the scenarios short. This one tests the minimum basket for SAVE10:
| Basket | Total after the code | Message |
|---|---|---|
| 49.99 | 49.99 | The code needs a basket of at least 50 |
| 50 | 45 | Code applied |
| 60 | 54 | Code applied |
| 200 | 180 | Code applied |
The row for 49.99 and the row for 50 test the boundary, where most mistakes happen.
A second example, with permissions
How to adapt it
- Write scenarios together. The Product Owner, a Developer and a tester, often called the three amigos, find more cases than one person alone.
- Start with the normal case, then ask "what if?" until the important edges are covered.
- Three to six scenarios per story is common. Many more suggests the story should be split. See Splitting user stories.
- Automate where it pays. Scenarios for rules that change often are worth turning into automated tests.
Common pitfalls
Scenarios that describe the screen. Button colors and field names change. The behavior usually doesn't.
Only the happy path. Most defects hide in the edges and errors.
Too many Ands. Long scenarios are hard to read and usually test several things.
Writing scenarios after the work. They help most before building, when they prevent misunderstandings.
Questions
What is Given, When, Then?
A format for acceptance criteria: Given a situation, When the user does something, Then a result follows. Each scenario is one concrete example of the behavior.
Where does Given, When, Then come from?
From behavior-driven development. Tools such as Cucumber use the same structure, called Gherkin, to run scenarios as automated tests.
How many scenarios should a story have?
Often three to six: the normal case, the important edges and the main error. Many more suggests the story should be split.
Do we need tools to use Given, When, Then?
No. Scenarios are useful on a card or in a document. Automation is an option, not a requirement.
Who writes Given, When, Then scenarios?
Usually the Product Owner and the Developers together, often with a tester. Writing them together brings out different views early.