Reviewing Gherkin
Overview
Reviewing a feature file is a different job from writing one. The text
already exists, somebody meant it, and the useful output is not a verdict
but a rewrite. A review that says "this is too imperative" helps nobody; a
review that shows the same scenario four lines shorter and more truthful
gets merged.
This skill supplies the diagnosis and the repair for each recurring defect.
When to use this skill
- A pull request adds or changes
.feature files.
- Someone asks whether a scenario reads well.
- A suite has become slow, flaky, or unreadable and nobody knows where to
start.
- Feature files arrive from another team and need assessing.
- A refactor of existing scenarios is requested.
If the scenarios do not exist yet, write them with the scenario-writing
skill instead. If the underlying rules were never agreed, no amount of
rewriting will fix the file, and the work belongs in discovery.
How to review
Read in three passes. Each pass finds a class of problem the others miss,
and doing them at once produces a scattered review.
- Names only. Read the feature name and every scenario name, in
order, ignoring the steps. Does the list describe a capability? Could a
reader spot a missing rule from the gaps? Most structural problems are
visible here alone.
- Altitude. Read the steps looking only for detail that has leaked
down from behaviour into mechanism, and for scenarios that depend on
each other.
- Truth. Ask whether each
Then is actually checkable by the person
who wanted the feature, and whether the file covers the refusals or
only the happy path.
Then write the review, leading with the two or three findings that matter,
each with a concrete rewrite.
The smell catalogue
Each entry gives the symptom, what it costs, and the repair. The full set,
with longer worked rewrites, is in references/smell-catalogue.md.
Interface detail in the wording
- Symptom: steps name buttons, fields, selectors, URLs, or screens.
- Cost: the specification breaks when the interface changes, and the
reader cannot tell whether the rule was satisfied.
- Repair: state the intent and move the mechanics into the step
definitions.
Scenario: Borrowing an available title records the loan
Given "Kindred" is available at Priya's branch
When she borrows it
Then the loan is recorded against her account
Conjunction steps
- Symptom: a single step joining two actions with "and".
- Cost: neither half can be reused, and a failure does not say which
half broke.
- Repair: split into separate steps, or collapse the first into a
Given that names its result.
More than one When
- Symptom: two or more
When steps in one scenario.
- Cost: two behaviours are being tested at once, so a failure is
ambiguous and the name cannot describe both.
- Repair: split the scenario, demoting the earlier action to a
Given
phrased as state.
Missing or vacuous Then
- Symptom: no
Then, or one that asserts nothing a person could
observe, such as "the record is saved".
- Cost: the scenario passes whatever the system does.
- Repair: state the consequence the requester cares about. If there is
no observable consequence, the case belongs in a unit test.
Test identifiers as names
- Symptom: names like
TC-114, Test 3, or Happy path.
- Cost: failure reports and the file index become useless.
- Repair: name the behaviour as a disputable claim.
Bloated Background
- Symptom: a
Background of many steps, some needed by only a few
scenarios.
- Cost: every scenario starts from a state its reader has to scroll up
to learn, and half of it is irrelevant.
- Repair: keep only what every scenario needs and what a reader must
know. Push the rest into the scenarios that use it, or split the feature.
Single-row outline
- Symptom: a
Scenario Outline with one Examples row.
- Cost: ceremony with no benefit; the reader hunts for a variation that
does not exist.
- Repair: write it as a plain
Scenario.
Dead columns
- Symptom: an
Examples column with the same value in every row, or
one that never affects the outcome.
- Cost: the reader has to work out that it does not matter.
- Repair: move the constant into the step text and delete the column.
Outline hiding several rules
- Symptom: rows whose outcomes differ in kind, often with a
valid or
expected result column switching the assertion.
- Cost: neither outcome can be stated plainly in the step text.
- Repair: split into one scenario per outcome.
Order-dependent scenarios
- Symptom: a scenario relying on state left behind by an earlier one.
- Cost: the suite cannot run in parallel, cannot run a single scenario,
and fails in confusing ways when one is skipped.
- Repair: give each scenario its own
Given steps, even if that
repeats setup. Repetition in the specification is cheaper than coupling.
Leaked technical vocabulary
- Symptom: words from the schema or the code where the business uses
different ones.
- Cost: the file stops being readable by the people it was written for.
- Repair: use the business word and let the step definition translate.
Unexplained values
- Symptom: literal numbers or codes with no stated meaning.
- Cost: the reader cannot tell what is significant, and the scenario
breaks when an unrelated threshold moves.
- Repair: name the concept in the step and let the step definition
produce whatever satisfies it.
Happy path only
- Symptom: every scenario succeeds.
- Cost: the rules are invisible, because a rule is only demonstrated by
the case it refuses.
- Repair: for each rule, add the case where it bites. If nobody can
say what that case is, the gap belongs in discovery.
Tags as runner configuration
- Symptom: tags encoding environments, browsers, or execution options.
- Cost: the specification carries operational detail that changes for
reasons unrelated to behaviour.
- Repair: keep tags descriptive and move execution choices into the
runner configuration.
Duplicate scenarios
- Symptom: two scenarios differing only in wording or in an irrelevant
value.
- Cost: both must be maintained, and a change to the rule will update
one of them.
- Repair: merge them, or make the difference explicit and meaningful.
The rubric
For a quick pass, score the file against these. Anything answered no is a
finding. The expanded version, with what to do about each, is in
references/review-checklist.md.
- Does the scenario name list read as a description of the capability?
- Does every scenario have exactly one
When?
- Could every
Then be checked by the person who requested the feature?
- Is the file free of selectors, URLs, screens, and schema names, except
where the contract itself is the subject?
- Does every rule have at least one scenario where it refuses something?
- Can each scenario run alone, in any order?
- Is every
Examples column load-bearing?
- Does the vocabulary match the words the business uses?
- Is the
Background short enough to hold in your head?
- Would someone outside the delivery team understand the file?
Delivering the review
The rewrite is the review. Show the current text, then the proposed text,
then one sentence on what changed and why. Three findings presented that
way land better than fifteen presented as rules.
Rank by cost. Interface detail and order dependence will cost the team
repeatedly; a slightly weak scenario name will not. Say which findings are
worth fixing now and which are worth noting.
Separate defects from preferences explicitly. "This will break when the
button is renamed" is a defect. "I would have phrased this differently" is
a preference, and saying so keeps the review credible.
Where the problem is that a rule was never agreed, say that rather than
proposing wording. No rewrite fixes an unagreed rule, and proposing one
invents a decision the reviewer is not entitled to make.
Common mistakes
- Reviewing wording while ignoring that half the rules are missing.
- Listing every smell found. A review with fifteen findings gets skimmed.
- Rewriting into the reviewer's own house style rather than fixing a
defect.
- Demanding declarative phrasing in a scenario whose subject genuinely is
the mechanism, such as a published API contract.
- Approving a file because the tests pass. Passing says nothing about
whether the file describes the right behaviour.
- Treating a long feature file as a formatting problem when it is a
boundary problem.
Reference files
references/smell-catalogue.md — every smell with a full worked
before-and-after rewrite.
references/review-checklist.md — the rubric expanded, plus a triage
order for a suite that needs work everywhere.
1---2name: gherkin-scenario-review3description: Critique and repair feature files that already exist. Use when reviewing a pull request that touches .feature files, when asked whether a scenario is any good, when a suite has grown unreadable or brittle, when auditing acceptance criteria inherited from another team, or when asked to clean up or refactor existing Gherkin. Supplies a catalogue of scenario smells with the rewrite for each, a review rubric, and guidance on delivering the feedback.4license: MIT5---67# Reviewing Gherkin89## Overview1011Reviewing a feature file is a different job from writing one. The text12already exists, somebody meant it, and the useful output is not a verdict13but a rewrite. A review that says "this is too imperative" helps nobody; a14review that shows the same scenario four lines shorter and more truthful15gets merged.1617This skill supplies the diagnosis and the repair for each recurring defect.1819## When to use this skill2021- A pull request adds or changes `.feature` files.22- Someone asks whether a scenario reads well.23- A suite has become slow, flaky, or unreadable and nobody knows where to24 start.25- Feature files arrive from another team and need assessing.26- A refactor of existing scenarios is requested.2728If the scenarios do not exist yet, write them with the scenario-writing29skill instead. If the underlying rules were never agreed, no amount of30rewriting will fix the file, and the work belongs in discovery.3132## How to review3334Read in three passes. Each pass finds a class of problem the others miss,35and doing them at once produces a scattered review.36371. **Names only.** Read the feature name and every scenario name, in38 order, ignoring the steps. Does the list describe a capability? Could a39 reader spot a missing rule from the gaps? Most structural problems are40 visible here alone.411. **Altitude.** Read the steps looking only for detail that has leaked42 down from behaviour into mechanism, and for scenarios that depend on43 each other.441. **Truth.** Ask whether each `Then` is actually checkable by the person45 who wanted the feature, and whether the file covers the refusals or46 only the happy path.4748Then write the review, leading with the two or three findings that matter,49each with a concrete rewrite.5051## The smell catalogue5253Each entry gives the symptom, what it costs, and the repair. The full set,54with longer worked rewrites, is in `references/smell-catalogue.md`.5556### Interface detail in the wording5758- **Symptom:** steps name buttons, fields, selectors, URLs, or screens.59- **Cost:** the specification breaks when the interface changes, and the60 reader cannot tell whether the rule was satisfied.61- **Repair:** state the intent and move the mechanics into the step62 definitions.6364```gherkin65Scenario: Borrowing an available title records the loan66 Given "Kindred" is available at Priya's branch67 When she borrows it68 Then the loan is recorded against her account69```7071### Conjunction steps7273- **Symptom:** a single step joining two actions with "and".74- **Cost:** neither half can be reused, and a failure does not say which75 half broke.76- **Repair:** split into separate steps, or collapse the first into a77 `Given` that names its result.7879### More than one When8081- **Symptom:** two or more `When` steps in one scenario.82- **Cost:** two behaviours are being tested at once, so a failure is83 ambiguous and the name cannot describe both.84- **Repair:** split the scenario, demoting the earlier action to a `Given`85 phrased as state.8687### Missing or vacuous Then8889- **Symptom:** no `Then`, or one that asserts nothing a person could90 observe, such as "the record is saved".91- **Cost:** the scenario passes whatever the system does.92- **Repair:** state the consequence the requester cares about. If there is93 no observable consequence, the case belongs in a unit test.9495### Test identifiers as names9697- **Symptom:** names like `TC-114`, `Test 3`, or `Happy path`.98- **Cost:** failure reports and the file index become useless.99- **Repair:** name the behaviour as a disputable claim.100101### Bloated Background102103- **Symptom:** a `Background` of many steps, some needed by only a few104 scenarios.105- **Cost:** every scenario starts from a state its reader has to scroll up106 to learn, and half of it is irrelevant.107- **Repair:** keep only what every scenario needs and what a reader must108 know. Push the rest into the scenarios that use it, or split the feature.109110### Single-row outline111112- **Symptom:** a `Scenario Outline` with one `Examples` row.113- **Cost:** ceremony with no benefit; the reader hunts for a variation that114 does not exist.115- **Repair:** write it as a plain `Scenario`.116117### Dead columns118119- **Symptom:** an `Examples` column with the same value in every row, or120 one that never affects the outcome.121- **Cost:** the reader has to work out that it does not matter.122- **Repair:** move the constant into the step text and delete the column.123124### Outline hiding several rules125126- **Symptom:** rows whose outcomes differ in kind, often with a `valid` or127 `expected result` column switching the assertion.128- **Cost:** neither outcome can be stated plainly in the step text.129- **Repair:** split into one scenario per outcome.130131### Order-dependent scenarios132133- **Symptom:** a scenario relying on state left behind by an earlier one.134- **Cost:** the suite cannot run in parallel, cannot run a single scenario,135 and fails in confusing ways when one is skipped.136- **Repair:** give each scenario its own `Given` steps, even if that137 repeats setup. Repetition in the specification is cheaper than coupling.138139### Leaked technical vocabulary140141- **Symptom:** words from the schema or the code where the business uses142 different ones.143- **Cost:** the file stops being readable by the people it was written for.144- **Repair:** use the business word and let the step definition translate.145146### Unexplained values147148- **Symptom:** literal numbers or codes with no stated meaning.149- **Cost:** the reader cannot tell what is significant, and the scenario150 breaks when an unrelated threshold moves.151- **Repair:** name the concept in the step and let the step definition152 produce whatever satisfies it.153154### Happy path only155156- **Symptom:** every scenario succeeds.157- **Cost:** the rules are invisible, because a rule is only demonstrated by158 the case it refuses.159- **Repair:** for each rule, add the case where it bites. If nobody can160 say what that case is, the gap belongs in discovery.161162### Tags as runner configuration163164- **Symptom:** tags encoding environments, browsers, or execution options.165- **Cost:** the specification carries operational detail that changes for166 reasons unrelated to behaviour.167- **Repair:** keep tags descriptive and move execution choices into the168 runner configuration.169170### Duplicate scenarios171172- **Symptom:** two scenarios differing only in wording or in an irrelevant173 value.174- **Cost:** both must be maintained, and a change to the rule will update175 one of them.176- **Repair:** merge them, or make the difference explicit and meaningful.177178## The rubric179180For a quick pass, score the file against these. Anything answered no is a181finding. The expanded version, with what to do about each, is in182`references/review-checklist.md`.183184- Does the scenario name list read as a description of the capability?185- Does every scenario have exactly one `When`?186- Could every `Then` be checked by the person who requested the feature?187- Is the file free of selectors, URLs, screens, and schema names, except188 where the contract itself is the subject?189- Does every rule have at least one scenario where it refuses something?190- Can each scenario run alone, in any order?191- Is every `Examples` column load-bearing?192- Does the vocabulary match the words the business uses?193- Is the `Background` short enough to hold in your head?194- Would someone outside the delivery team understand the file?195196## Delivering the review197198The rewrite is the review. Show the current text, then the proposed text,199then one sentence on what changed and why. Three findings presented that200way land better than fifteen presented as rules.201202Rank by cost. Interface detail and order dependence will cost the team203repeatedly; a slightly weak scenario name will not. Say which findings are204worth fixing now and which are worth noting.205206Separate defects from preferences explicitly. "This will break when the207button is renamed" is a defect. "I would have phrased this differently" is208a preference, and saying so keeps the review credible.209210Where the problem is that a rule was never agreed, say that rather than211proposing wording. No rewrite fixes an unagreed rule, and proposing one212invents a decision the reviewer is not entitled to make.213214## Common mistakes215216- Reviewing wording while ignoring that half the rules are missing.217- Listing every smell found. A review with fifteen findings gets skimmed.218- Rewriting into the reviewer's own house style rather than fixing a219 defect.220- Demanding declarative phrasing in a scenario whose subject genuinely is221 the mechanism, such as a published API contract.222- Approving a file because the tests pass. Passing says nothing about223 whether the file describes the right behaviour.224- Treating a long feature file as a formatting problem when it is a225 boundary problem.226227## Reference files228229- `references/smell-catalogue.md` — every smell with a full worked230 before-and-after rewrite.231- `references/review-checklist.md` — the rubric expanded, plus a triage232 order for a suite that needs work everywhere.