What is Gherkin?

IT knowledge

Have you ever experienced the tragedy of a system development project where “the final product is different from the specifications”?
To bridge this communication gap and ensure the entire team shares the same vision, let us introduce a language called “Gherkin.”

1. What is Gherkin?

In short, Gherkin is a set of rules for describing system behavior in plain, human-readable language. It is a syntax used to write software specifications and acceptance criteria in structured prose that resembles natural language. It is primarily used in BDD (Behavior-Driven Development). The goal is to make specifications easy to read for everyone—developers, QA, Product Owners, and non-technical stakeholders alike.

2. The Core Feature: “Given / When / Then”

The most important aspect of Gherkin is using specific keywords to write in a bullet-point format.

  • Feature: Description of the functionality
  • Scenario: A specific use case
  • Given: The preconditions (the context)
  • When: The user action or event
  • Then: The expected result
  • And / But: Additional conditions or results

By simply following this “what if” template, anyone can write specifications without needing any programming knowledge.


3. A Concrete Example: Login Functionality

For example, here is how you would describe a web shop’s login feature using Gherkin:

Feature: Login Functionality

Scenario: Successful login with valid credentials

Given the user is on the login page

When they enter a valid email address and password

And they click the “Login” button

Then the “My Page” dashboard is displayed

See how it works? Even a Director or a client who isn’t an engineer can understand exactly “what needs to be verified” at a glance.


4. Benefits of Adopting Gherkin

① Eliminates Ambiguity

Using the “Given/When/Then” structure removes vagueness from specifications. This leads to smoother alignment between the business side and the development side.

② It Becomes Your “Test Cases”

By using specific tools (like Cucumber), these sentences can actually be executed as code. It feels like magic: the system automatically checks if it’s working correctly just by reading your text.

③ It Stays a “Living Document”

Traditional specification documents often become obsolete and end up as “digital trash.” Because Gherkin scripts are executed daily as tests, they function as a living document that always reflects the current system specifications.


Summary

Gherkin isn’t just for techies; it is a “common language for the whole team.” If you want to communicate specifications more clearly or make your testing more efficient, why not try adopting the rhythm of “Given / When / Then”?