What is Gherkin and where does it really fit into the Behavior-Driven Development (BDD) landscape?
Gherkin is “Given When Then” notation. It’s what we write our executable specifications in when we practice BDD with tools such as Cucumber.
It’s designed to be both business friendly & easy to automate.
When you take a look at a real Gherkin script, you can see it’s written in almost-plain English. You can also see that it’s written in terms that a non-technical person could understand and relate to. Of course, the technical people can understand this as well.
Gherkin is above all, a communication tool.
The rules and examples are captured in plain English, it’s business-readable, and finally, this plain English text that you see is actually executable. We can wire this up to test automation code, and turn these plain English statements into fully fledged automated acceptance tests using tools such as Cucumber to understand the Gherkin notation. Cucumber lets us automate our Gherkin specifications in any of the common programming languages: Java, JavaScript, Ruby, and many others.
To recap, the benefits of using Gherkin:
- Plain English documentation of the rules and features that surround a given feature or story
- Business Readable: Easily understood by technical and non-technical team members
- Executable: By conforming to certain rules, these plain English specifications can be automated
Learn more about Gherkin – watch this full presentation.
Contact us to schedule a custom private workshop on Gherkin and other Agile topics.