Gherkin's failure mode is not missing scenarios — it is vague ones: "When the user does something invalid, Then an error is shown." AI drafts scenario sets fast; the taught skill is the critique pass that catches untestable steps before they harden into step definitions half the team depends on.
Tier: Foundation · Workflow area: Test design & planning
This playbook generates Given/When/Then scenarios from acceptance criteria with step-definition scaffolding for Cucumber or Behave, then runs a dedicated vague-step detection pass. Vague steps are the BDD-specific hallucination: syntactically perfect, semantically empty, and expensive to unwind once automated.
When NOT to use:
cucumber-js), Behave, or equivalent, already running in the repo so dry-runs are possible from minute one.Generate scenarios with strict concreteness rules. The rules in the prompt are the difference between usable Gherkin and generic filler:
Convert these acceptance criteria into Gherkin scenarios for Cucumber.
Hard rules:
- Every Given/When/Then must reference CONCRETE values ("a cart totaling
€149.99"), never abstractions ("some items").
- No step may contain "correctly", "properly", "appropriately",
"successfully", "as expected", or "valid/invalid" without defining it.
- Use Scenario Outline + Examples tables when 3+ scenarios differ only
in data.
- Tag each scenario with its AC number: @AC-3.
- If an AC is too vague to make concrete, output it under "CANNOT
SPECIFY" with the question that needs answering. Do not guess.
Acceptance criteria: [paste, numbered]
Run the vague-step detector as a second pass. Fresh instruction, applied to the output — the model finds its own weasel words more reliably when critique is a separate task:
Audit these scenarios as a BDD coach. Flag every step that is:
VAGUE (no observable pass/fail), UNBOUND (value left abstract),
COMPOUND (two behaviors in one step), UI-COUPLED (asserts widget
internals instead of behavior), or MISSING-ELSE (a When with no
negative-path sibling scenario).
Output: step text, flag, and a rewritten concrete version.
Good output looks like this:
# FLAGGED — VAGUE:
# Then an appropriate error message is displayed
# REWRITE:
Then the message "Card declined — no funds were taken" is displayed
And the order status remains "Draft"
Apply your own pass over the flags. Accept, reject, or sharpen each rewrite. Watch for the detector's blind spot: steps that are concrete but assert the wrong thing entirely — only your product knowledge catches those.
Scaffold step definitions and dry-run. Have the assistant generate matching step-definition stubs, then let the framework verify every step binds:
npx cucumber-js --dry-run features/checkout.feature
behave --dry-run features/checkout.feature
Dry-run failures reveal the drift the model introduces between scenario wording and step patterns — fix wording toward your existing step vocabulary, not the other way around, or you fork the step library.
Reuse before you add. Diff the generated steps against your existing step-definition library; every near-duplicate ("I log in" vs "I am logged in") the model invented should collapse into the established step. Paste your step catalog into the generation prompt next time to prevent the drift at the source.
A vague step that gets automated is worse than no step — the step definition's author resolves the ambiguity silently in code, the feature file stops meaning what it says, and every future reader is misled by green.
@given/@when/@then functions and run behave --dry-run --no-snippets in CI so unbound steps fail the build permanently, not just at authoring time.cucumber-js --dry-run/behave --dry-run output.In BDD, the scenario text is the contract — generation gives you volume, but the vague-step critique is what keeps the contract enforceable. Never automate a step you had to interpret to implement.