Gherkin is the language used to write specifications for Cucumber, Specflow and similar BDD frameworks. It is a business-readable, domain-specific language that lets you describe your software’s behaviour without detailing how that behaviour is implemented.
Gherkin is the language used to write specifications for Cucumber, Specflow and similar BDD frameworks. It is a business-readable, domain-specific language that lets you describe your software’s behaviour without detailing how that behaviour is implemented.
Gherkin serves two purposes — documentation and automated tests. The third is a bonus feature — when it yells in red it’s talking to you, telling you what code you should write.
Gherkin’s grammar is defined in the Treetop grammar that is part of the Cucumber codebase. The grammar exists in different flavours for many spoken languages (37 at the time of writing), so that your team can use the keywords in your own language.
There are a few conventions:
- A single Gherkin source file contains a description of a single feature.
- Source files have the extension .feature.
- There is a fundamental pattern to each Gherkin scenario, with a context: (Given), an event (When), and an outcome (Then).
Gherkin was invented by Alsak Hellesoy.
You can read more about Gherkin here: https://github.com/cucumber/gherkin/wiki
Documentation of Cucumber and Gherkin: https://www.cucumber.io/
.NET implementation: http://www.specflow.org/
Python implementation: https://behave.readthedocs.io/