Skip to main content
Automation
DEFINITION

What is Gherkin?

Gherkin is a plain-language, structured syntax for writing Behavior-Driven Development scenarios using keywords like Feature, Scenario, Given, When, Then, And, and But. Each line describes a precondition, an action or an expected outcome in business terms, and tools such as Cucumber bind those lines to code so the scenario runs as an automated test.

No account needed · Scored in under a minute against a senior rubric

IN DEPTH

What does Gherkin mean in practice?

Gherkin lets teams describe software behavior in a way both humans and automation tools can read. A .feature file starts with a Feature describing the capability, then contains one or more Scenarios. Each scenario uses Given to set context, When to trigger an action, and Then to assert the outcome, with And/But chaining additional steps.

Gherkin supports Scenario Outline with an Examples table for data-driven cases, Background for shared setup, and tags (@smoke, @regression) for selective execution. Tools such as Cucumber, SpecFlow, Behave, and Karate parse these steps and bind them to step-definition code (Karate notably needs no glue code).

Good Gherkin is declarative and reads like documentation: "When the user submits the form" rather than imperative UI mechanics like "When the user clicks #submit". Overly technical, brittle steps are the most common smell, they couple business documentation to implementation detail and defeat the purpose of a shared language.

WHY IT MATTERS

Why do interviewers ask about Gherkin?

QA and SDET interviews use Gherkin to check whether you can write maintainable, declarative scenarios rather than imperative click-by-click scripts that break on every UI change.

EXAMPLE

What does Gherkin look like in a real project?

A team writes Gherkin steps full of CSS selectors and explicit waits. Every UI tweak breaks dozens of scenarios. They refactor to declarative business steps ("Given a logged-in premium user") and push the mechanics into step definitions, so product owners can read the features and the suite stops breaking on cosmetic changes.

TIP

How should you talk about Gherkin in an interview?

Show that you know the difference between declarative and imperative steps, and mention Scenario Outline and Background. Bonus points for noting that Karate uses Gherkin without separate step definitions.

FAQ

Common questions about Gherkin

Is Gherkin a programming language?

No. Gherkin is a structured natural-language syntax. The automation logic lives in step definitions written in a real language (Java, Python, JS, C#), except in tools like Karate that interpret the steps directly.

What makes a good Gherkin scenario?

It is declarative, focuses on business behavior rather than UI mechanics, stays short (a handful of steps), and avoids selectors or technical detail so non-developers can read it.

FREE TOOLS  /  no signup

Free QA career tools, no account needed

Instant and private, everything runs in your browser. Try them before you sign up.

EXEC.NOW

Ready to Ace Your QA Interview?

Practice explaining gherkin and other key concepts with our AI interviewer.

Join 500+ QA engineers already practicing with AssertHired.

Question 1 · Automation · Mid-levellive scoring

A test passes locally but fails in CI about one run in five. Walk me through what you check first, and why.

Scored on the same four dimensions as the real thing: Technical accuracy · Coverage · Clarity · Best practices.

Rather skip ahead? Create a free account

FREE.TO.START  ·  7.DAY.TRIAL ON PAID PLANS
Written by , Senior QA Automation Engineer, 50+ QA candidate interviews conductedLast updated July 2026