Gherkin has a reputation as a QA tester’s tool, not a Product Owner’s. That’s a mistake that costs teams dearly: every time a story goes to dev without Gherkin criteria written by the PO, the dev or tester invents them instead — and they rarely guess the same thing you would.
What Gherkin actually is
Gherkin is a structured, near-natural-language format used to describe the expected behavior of a feature as scenarios. It relies on three keywords: Given (initial context), When (triggering action), Then (expected outcome).
Feature: User login
Scenario: Successful login
Given I am on the login page
When I enter a valid email and password
Then I am redirected to my dashboard
This format isn’t tied to any specific test framework (Cucumber, Behave, and SpecFlow all use it), but its value for a PO isn’t automation — it’s precision. Writing a Gherkin scenario forces you to make a state, an action, and an outcome explicit, whereas a free-form sentence leaves all three implicit.
Why a PO should master Gherkin, not just delegate it
Delegating acceptance criteria to the tester or dev means delegating part of the product decision — because defining “what should happen when X” IS a product decision, not a technical detail.
Three concrete reasons to own Gherkin yourself:
- You eliminate ambiguity at the source. The dev no longer has to interpret your intent, they implement a scenario written in black and white.
- You speed up acceptance testing. A Gherkin scenario becomes a test case directly — for you in manual review, or for QA in automation.
- You structure your own thinking. Writing “Given / When / Then” forces you to consider the initial state and edge cases, something a plain user story often omits (see How to Write Quality User Stories with AI for how the two formats connect).
The basic syntax
A Gherkin feature groups several scenarios related to the same functionality:
Feature: [Feature name]
As a [role]
I want [action]
So that [benefit]
Scenario: [Scenario name]
Given [initial state]
When [action]
Then [expected outcome]
And [additional outcome]
A few useful rules:
Andchains multiple conditions of the same type without repeating Given/When/ThenButexpresses an exception within a series of expected outcomesScenario Outline+Exampleslet you factor several variants of the same scenario with different data (useful for testing several invalid email formats, for example)
Scenario Outline: Email format validation
Given I am on the signup form
When I enter "<email>" as my email address
Then I see the message "<result>"
Examples:
| email | result |
| test@example.com | Signup successful |
| test@ | Invalid email format |
| no-at-sign.com | Invalid email format |
The 4 scenario types you need to know
A well-covered feature doesn’t just cover the happy path. Four categories to systematize:
- Nominal scenario — the happy path, the most frequent and expected case.
- Alternative scenario — a valid variant that differs from the main path (e.g., bank transfer instead of card payment).
- Error scenario — invalid input or a technical failure (declined card, empty required field).
- Edge-case scenario — the boundaries of the system: extreme data volume, null values, concurrent actions happening at once.
A story that only covers the nominal scenario gives the dev a false impression of completeness. That’s usually where bugs surface during acceptance testing — never before.
3 complete feature examples
Password reset
Feature: Password reset
Scenario: Successful request
Given I have an account with email "user@example.com"
When I request a password reset
Then I receive an email with a link valid for 30 minutes
Scenario: Expired link
Given I received a reset link more than 30 minutes ago
When I click on that link
Then I see a message inviting me to request a new one
Scenario: Unknown email
Given no account is associated with "unknown@example.com"
When I request a reset for that email
Then I see a generic confirmation message
And no email is actually sent
Adding to cart
Feature: Adding an item to cart
Scenario: Adding an in-stock item
Given an item is in stock
When I click "Add to cart"
Then the item appears in my cart
And the cart counter increases
Scenario: Out-of-stock item
Given an item is out of stock
When I view its product page
Then the "Add to cart" button is disabled
And an "Out of stock" message is displayed
Data export
Feature: Exporting order history
Scenario: Successful export
Given I have at least one order in my history
When I click "Export as PDF"
Then a PDF file is generated and downloaded
And it contains all my orders from the last 12 months
Scenario: No orders to export
Given I have no orders in my history
When I click "Export as PDF"
Then the button is disabled
And a tooltip explains why
The most common mistakes
- Confusing implementation steps with behavior. “Given the database contains a user” is fine; “Given the SQL query returns a user” is not — Gherkin describes observable behavior, not technical implementation.
- Scenarios that run too long. More than 5-6 Given/When/Then lines is usually a sign you need to split into several scenarios.
- Forgetting error and edge-case scenarios. The natural instinct is to write only the nominal path — it’s exactly the opposite that prevents production bugs.
- Inconsistent vocabulary across scenarios (“user” vs “customer” vs “member” for the same person) — this complicates test automation and blurs understanding.
AI-assisted generation
Manually writing all 4 scenario types for every feature is time-consuming — exactly the kind of task where a structured AI agent saves time without sacrificing rigor. AI Product Copilot automatically generates nominal, alternative, error, and edge-case scenarios from a plain-language feature description, with direct export to Jira or Confluence.
The method I recommend: describe the need, let the agent propose all 4 scenario types, then review and adjust — especially the edge cases, which often depend on business context only you really know.
Going further
Gherkin is the bridge between a user story and a verifiable spec — see How to Write Quality User Stories with AI for the upstream piece. And if you want to go even further upstream, before writing the first story, Discovery Agent AI: How to Extract Your Product Requirements in 10 Minutes explains how to structure that step with AI.
Want to try AI-generated Gherkin scenarios? AI Product Copilot turns a feature description into complete acceptance criteria in minutes.
Stéphanie Caumont
AI Product Owner · Learn more