Skip to main content

Gherkin

Gherkin is the plain-language, structured syntax used to write Behavior-Driven Development scenarios in a Given/When/Then format — readable by non-technical stakeholders while still being precise enough for tools like Cucumber and SpecFlow to parse and execute as automated tests.

A Gherkin file (a "feature file") describes behavior in structured English: Feature (what's being described), Scenario (a specific example), and Given/When/Then/And steps that describe the starting state, the action, and the expected outcome. Each step maps to a piece of automation code (a "step definition") that actually executes it.

The value of Gherkin isn't the syntax itself — it's that the exact same document reviewed and agreed on by a product owner is the literal thing running in CI, with no translation gap between "what we agreed to build" and "what's actually being tested."

Example

Feature: Password reset

  Scenario: User requests a reset link with a valid email
    Given a registered user is on the "Forgot Password" page
    When they submit their registered email address
    Then they receive a password reset email within 1 minute

A Gherkin feature file — plain English, but executable.

Gherkin — Definition, Example & How It's Used | QA Bash Glossary | QA Bash