Gherkin is a plain-text, structured language for writing behavior specifications in Given-When-Then form. Popularized by Cucumber, it lets business-readable scenarios double as executable acceptance tests.
Gherkin
Gherkin is a plain-text, structured language for describing software behavior as human-readable scenarios. Popularized by the Cucumber framework, it organizes each scenario around the Given-When-Then pattern so that a specification a business stakeholder can read is also an artifact a test runner can execute. It is less a technology than an agreed-upon grammar for stating “under this context, when this happens, expect this outcome.”
- Given-When-Then structure -
Givensets up context,Whentriggers an action, andThenasserts the expected result. - Business-readable syntax - Scenarios are written in near-natural language, keeping product owners and engineers reading the same document.
- Executable specifications - Each step binds to step-definition code, so the same scenario is both documentation and an automated test.
- Feature files - Scenarios group into
.featurefiles that live in version control next to the code they describe.
In API work, Gherkin shows up as the acceptance layer over a contract: the OpenAPI definition says what an endpoint accepts and returns, and Gherkin scenarios assert how it should behave under specific inputs. Teams use it to turn ambiguous requirements into runnable checks in CI, and the same Given-When-Then framing is a natural fit for the agentic turn — an agent handed clear behavioral scenarios has an unambiguous, testable statement of intent to work against rather than prose it must interpret.
Referenced on the API Evangelist blog
Where this standard shows up across sixteen years of my writing at apievangelist.com — how it fits into API design, governance, and the agentic turn.