Skip to the content.

Gherkin and Automation

Table of Content

Introduction

Let start with some definitions:

  1. Gherkin: Gherkin is a simple, human-readable language used to describe and define automated tests in a behaviour-driven development (BDD) approach. It uses a structured language syntax that is designed to be easily readable by both technical and non-technical team members. Gherkin is often used in conjunction with BDD frameworks such as Cucumber and SpecFlow to write and execute automated acceptance tests. The Gherkin syntax consists of a set of keywords and statements that allow users to define the behaviour of a system in a clear and concise way.

Gherkin was originated as part of the Cucumber framework, which was initially created in Ruby in 2008 by Aslak Hellesøy. Gherkin was later implemented in multiple programming languages and became a standalone specification language for defining behaviour in a structured, human-readable format.

  1. Specflow: SpecFlow is an open-source testing framework for behaviour-driven development (BDD) that allows the creation of executable specifications using a plain text language. It allows the definition of feature files written in Gherkin, which describe the behaviour of the system in a way that can be easily understood by stakeholders, product owners, developers, and testers. These feature files can then be used to generate automated tests that can be executed against the system under test. SpecFlow integrates with popular .NET testing frameworks like NUnit, xUnit, and MSTest, and supports a wide range of programming languages and IDEs.

  2. Cucumber: Cucumber is a behaviour-driven development (BDD) tool that allows you to write automated tests in a human-readable format. Like SpecFlow, Cucumber supports Gherkin syntax, which allows for collaboration between business stakeholders and technical teams. Cucumber also integrates well with Java-based testing frameworks like JUnit and TestNG.

References