agentleFS
mejbaurbaharmejbaurbahar/software-tester-skills/skills/bdd-gherkin-testing/SKILL.md

bdd-gherkin-testing

Skill1 starsChanged 54 days agoMITView on GitHub

Use when writing or automating behavior-driven development (BDD) specs — Gherkin Given/When/Then, Cucumber, SpecFlow, Behave, pytest-bdd, Playwright-BDD, example mapping, living documentation, and fixing brittle or imperative feature files.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use Background only for context every scenario needs and that is short.

    line 40
  2. Very specific:

    Use Scenario Outline + Examples for data variation.

    line 41

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

BDD & Gherkin

BDD is a collaboration practice first, a test tool second. Feature files are executable specifications that product, dev and QA agree on before coding (the "three amigos").

Discovery: Example Mapping (25 min per story)

Cards: Story (yellow) → Rules (blue) → Examples (green) → Questions (red). If red cards outnumber green, the story is not ready. Each green card becomes one scenario.

Write declarative, not imperative

# BAD — imperative, UI-coupled, brittle
Scenario: Login
  Given I open "https://app.test/login"
  When I type "ann@x.com" into "#email"
  And I click "#submit"
  Then I see the element ".dashboard"

# GOOD — declarative, business language
Feature: Account access
  Rule: Locked accounts cannot sign in

  Scenario: Locked customer is told how to recover
    Given Ann's account was locked after 5 failed attempts
    When Ann signs in with the correct password
    Then she is told the account is locked
    And she is offered a password-reset link

Gherkin rules of thumb

  • One behavior per scenario; 3–7 steps; Given = state, When = one action, Then = observable outcome.
  • Use Background only for context every scenario needs and that is short.
  • Use Scenario Outline + Examples for data variation; name example columns meaningfully.
  • Tag for selection: @smoke @regression @wip @slow @api @ui. Run subsets with --tags.
  • No And chains in When; no assertions in Given; no implementation words (click, table, id).

Tooling quick start

StackToolRun
JS/TS@cucumber/cucumber, playwright-bddnpx cucumber-js --tags "@smoke and not @wip"
Pythonbehave, pytest-bddbehave --tags=@smoke / pytest -m smoke
JavaCucumber-JVM + JUnit 5mvn test -Dcucumber.filter.tags="@smoke"
.NETReqnroll / SpecFlowdotnet test --filter Category=smoke
RubyCucumbercucumber --tags @smoke

Step definitions stay thin: parse → call a domain/driver layer (API client or page object) → assert. Never put business logic in steps. Share state via a per-scenario World/context object, never globals.

Living documentation

Publish results (Cucumber HTML/JSON report, Allure, Serenity) so business readers see which rules are passing. A failing scenario should read as a business sentence.

Anti-patterns

  • Feature files written by QA alone after the code ships (BDD as "Selenium with English").
  • Scenarios per UI screen; hundreds of near-duplicates; steps like I click the 3rd button.
  • Assertions on internals (DB rows) when an observable outcome exists.
  • Slow suites: run most rules at API/service level; keep UI scenarios to critical journeys (e2e-testing).

Related skills

acceptance-testing, test-design-techniques, e2e-testing, api-testing, test-automation

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.