Gherkin: A Language for Behavior-Driven Development

Harpreet Singh Kalsi
I am a dummy, enlighten me!
6 min readNov 10, 2023

--

When I first of heard of Gherkin a few years back, I was like what, who’s kin? Then I started reading a bit more and learnt more about it. I read more about BDD and got to know more on Gherkin — What it means and where it is typically used. Below is the TDLR version for you guys. It is part of my series — I am a dummy, enlighten me.

What is Gherkin?

Gherkin is a language that developers use to define tests in Cucumber, an open-source software testing tool that supports behavior-driven development (BDD). Gherkin uses plain English to describe the behavior of a software system in a way that can be read and understood by almost anyone involved in the project, such as developers, managers, business analysts, and customers.

Gherkin follows a simple syntax that consists of keywords, steps, and scenarios. Keywords are words that have a special meaning in gherkin, such as Feature, Scenario, Given, When, Then, And, and But. Steps are sentences that start with a keyword and describe an action or an outcome. Scenarios are collections of steps that define a specific example of how the system should behave under certain conditions.

Here is an example of a gherkin feature file that describes a login functionality for a website:

Feature: Login

--

--

Harpreet Singh Kalsi
I am a dummy, enlighten me!

Software Engineering Leadership | Advisor | Product Management | Book author