LeverX Blog | #LEVERXPEOPLE

Why Business Analysts Should Care About Gherkin

Written by Liza | Oct 7, 2025 1:46:17 PM

This article comes from a speech given by Senior Business Analyst Katsiaryna Serhiyenia at LeverX Analyst Day. 


Why Business Analysts Should Care About Gherkin

Have you ever had a use case misunderstood by developers? Or spent hours clarifying requirements that seemed obvious at first? If so, you might benefit from Gherkin, a tool that bridges the gap between developers, BAs, and clients. 

In short, Gherkin is a technique to document requirements. It turns business rules into simple, structured examples that everyone can read — and even automate as tests.

Gherkin can make requirements clearer and easier to share across business, development, and QA. It doesn’t replace existing BA practices, but it can complement them and help analysts avoid ambiguity, speed up feedback, and keep requirements relevant throughout the project.

A Short History: How Gherkin Appeared in Business Analysis

By the late 2000s, one problem became obvious in IT business analysis. While business stakeholders described requirements in one language, developers interpreted them in another. And testers? They checked behavior in yet another way.

At the time, a lot of work was done to classify and structure requirements. Books like Software Requirements (Wiggers, Beatty) and BABOK editions gave BAs tools to capture, specify, and manage them.

Norwegian developer Aslak Hellesøy tried to solve this misalignment and created Cucumber in 2008. Together with it came Gherkin, a simple scenario language that currently supports 70+ languages.

As Katsiaryna puts it, “The idea was simple — describe the system’s behavior using examples written in plain, understandable language. That became the foundation for Behavior-Driven Development (BDD).”

What Is BDD and Why It Matters

Behavior-Driven Development (BDD) focuses on examples of system behavior in concrete situations, rather than relying on long documentation. 

These examples are written in Gherkin, which makes them easy to read for everyone — business stakeholders, developers, and testers alike. Importantly, Gherkin is not used in isolation; it exists as part of the broader BDD approach and is closely tied to tools like Cucumber.

With Cucumber, these Gherkin examples can be executed directly as automated tests.

Katsiaryna explains, “Cucumber itself is just software. It reads files written in Gherkin, runs them as tests, and shows which steps passed and which failed. Developers link the steps to code, while analysts and QA make sure the scenarios reflect the agreed business rules.”

In practice, this means that a single artifact — the scenario — serves two purposes at once: it functions both as a requirement and as a test case.

How Does Gherkin Work

Gherkin is a structured language used to describe software behavior without detailing how that functionality is implemented. The language follows the “Given-When-Then” principle. This structure is mandatory, meaning that every use case must be described according to this strict format.

For example, here is how a simple login flow could be described using the Use Case template:

Basic flow:

  1. The user navigates to the login page.
  2. The system displays a login form with fields for email and password.
  3. The user enters valid credentials and clicks the "Login" button.
  4. The system validates the credentials against stored data.
  5. The system creates a session for the user.
  6. The user is redirected to the dashboard.

Alternative flow: Invalid credentials

  1. The system displays an error message: "Invalid username or password."
  2. The user remains on the login page.

Alternative Flow: Account locked after 5 failed attempts

  1. The system locks the account temporarily.
  2. The system displays an info message.
  3. The system sends an email notification to the user.

In Gherkin, these three flows would be documented as three separate scenarios.

Core Gherkin Keywords Every BA Should Know

Before we dive into the specific language you need to use with Gherkin, we need to note that Gherkin’s initial purpose was to automate testing scenarios. This is why it uses specific keywords to trigger certain actions.

To use Gherkin correctly, you need to follow the keywords and the information structure suitable for this tool. In addition, when other team members copy information from Gherkin, for example, a QA Engineer uses it to build their test cases, it’s crucial that the language you use works for them, as well. And what if your scenarios are later used for automation? The more precisely you use Gherkin info structure, the better.

But don’t worry, you don’t need dozens of constructs to start. Nine basic ones are enough.

Feature

This keyword defines the main functionality or business goal that the scenarios in a .feature file describe.

“Feature” acts as the title for a group of related scenarios. All scenarios inside are variations of that functionality, e.g., successful login, failed login, and account lockout. This keyword answers the question: "What functionality are we describing and why?"

“Feature” can include a short business context or goal description. A common structure in the description includes:

  • Goal (In order to...): What I want to achieve
  • Role (As a...): Who I am
  • Need/Action (I want to...): What I need to do to achieve the goal

For example,

Background

The “Background” keyword defines common setup steps that should be executed before each scenario within a single Feature or Rule.

This keyword describes a shared context for all scenarios and helps to avoid repeating the same Given steps in multiple scenarios. “Background” makes .feature files cleaner and easier to read, especially when the setup is complex.

For example,

Rule

“Rule” is an optional keyword used to group scenarios under a named business rule. It helps make a specific requirement within a Feature explicit.

This keyword proves especially handy when you need to structure complex features into smaller logical parts. It can also help you highlight a business rule directly in the .feature file, improving readability and maintenance when there are multiple rules in the same feature.

Whereas “Feature” has broad functionality, the “Rule” defines a specific condition or policy (e.g., “Premium users get a discount”). Note that each “Rule” has one or more scenarios to illustrate how the rule would be applied.

For example,

Scenario

“Scenario” keyword stands for a concrete, testable example of how the system should behave in a specific situation. It formalizes requirements as concrete examples, making descriptions clear to business, developers, and testers alike. 

Later on, examples described as “Scenario” can be transformed into automated tests with tools such as Cucumber.

When it comes to using the “Scenario” keyword, you should follow certain rules:

  • Each scenario should be independent, so it can be run on its own.
  • Avoid combining multiple business cases into one scenario.
  • The title should briefly state what is being tested.

For example,

Given, When, Then, And, But

These five keywords make scenarios easier to read and more logically structured:

  • “GIVEN” sets the context and preconditions. 
  • “AND(*)” adds more steps of the same type.
  • “WHEN” describes the main action.
  • “BUT” adds a contrasting or exception step.
  • “THEN” describes the expected result.

For example,

“Nine words are enough to describe any system behavior in Gherkin format. They provide structure without overloading the process,” Katsiaryna noted.

Advanced Keywords

Beyond the basics, Gherkin also supports ways to avoid duplication and keep scenarios clean:

  • Scenario Outline with Examples to repeat the same scenario with different data sets.
  • Data Tables to provide structured values inside steps.
  • Tags (@) to label scenarios for grouping, filtering, or linking to priorities.

These tools help when features grow complex or when test coverage needs to be transparent.

What Business Analysts and Teams Gain from Gherkin

Gherkin is not a silver bullet. It works best in teams with a collaborative, example-driven culture such as BDD or ATDD, and it doesn’t replace other BA artifacts like diagrams or user stories. Still, when applied thoughtfully, it can bring tangible benefits.

Gherkin Benefits for Business Analysts

Gherkin offers a way to make requirements more structured and less ambiguous. The “Given–When–Then” format forces analysts to think in examples, which often helps uncover edge cases early. It also makes collaboration with developers and QA easier, especially in workshop formats like the “Three Amigos,” where the whole team discusses scenarios together.

Gherkin Benefits for Business Stakeholders

Business stakeholders also gain from this approach. Because the scenarios are written in plain language, they are easy to read without technical background knowledge. Stakeholders can quickly see which situations are covered, which are not, and how the logic will work before development begins. Since Gherkin scenarios are treated as living documentation, they also remain relevant as the system evolves.

Gherkin Benefits for Developers

Gherkin scenarios provide a ready foundation for automation with tools such as Cucumber, SpecFlow, or Behave. They reduce the risk of misunderstandings by keeping requirements, code, and tests aligned in one place. And thanks to their testable format, teams receive faster feedback, catching logical errors before or early in development.

Key Takeaways

Gherkin helps to unify the language between business and technology, creating a shared format that both sides can easily understand. When scenarios are written clearly, they keep requirements concise, testable, and ready for automation. At the same time, their effectiveness depends on consistency: scenarios only provide value if the team is committed to maintaining them and keeping them current.

Business analysts don’t need to treat Gherkin as a replacement for their existing tools, but rather as a complement to them. It proves especially valuable when clarity, automation, and collaboration are the priorities. 

For teams that are new to Gherkin, starting with just a few small features can be a practical first step. For those already using it, the reminder was that the true goal is not perfect syntax but genuine alignment between business needs and technical implementation.

Katsiaryna notes, “Gherkin won’t solve all communication problems. But it’s a simple, disciplined way to make requirements clearer, and that alone is worth trying in your projects.”