Gherkin

Testing intermediate

Gherkin is a structured plain-text language used to write BDD scenarios in a Given/When/Then format readable by both business and technical teams.

Summary

Gherkin is the domain-specific language used to express BDD test scenarios. Its Given/When/Then structure makes test cases readable by non-technical stakeholders while remaining executable by test frameworks.

What is Gherkin?

Gherkin provides a small vocabulary—Feature, Scenario, Given, When, Then, And, But—that describes software behaviour without referring to implementation details. A Feature file groups related scenarios for a single piece of functionality. Each Scenario describes a specific case through context (Given), action (When), and expected outcome (Then).

Frameworks like Cucumber, Behave, and SpecFlow parse Gherkin files and match each step to a step definition—a code snippet that drives the application. This keeps the natural-language specification and the executable test tightly coupled.

Gherkin supports data-driven testing via Scenario Outlines with Examples tables, allowing one template to run against multiple input sets without duplicating scenario text.

Why is Gherkin relevant?

  • Shared language: A single format that business analysts, QA, and developers all read and contribute to
  • Executable specification: Scenarios are both documentation and automated tests, preventing drift
  • Broad framework support: Gherkin is supported by Cucumber (JVM, Ruby, JavaScript), Behave (Python), SpecFlow (.NET), and more

We are here for you

You are interested in our courses or you simply have a question that needs answering? You can contact us at anytime! We will do our best to answer all your questions.

Contact us