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.
Free to start · 7-day trial on paid plans
In depth.
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 interviewers ask about this.
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 scenario.
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.
Interview tip.
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.
Frequently asked questions.
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.
Related Terms
Explore related glossary terms to deepen your understanding.
Related Resources
Dive deeper with these related interview prep pages.
Free QA career tools, no account needed
Instant and private, everything runs in your browser. Try them before you sign up.
QA Resume Checker
Instant 0-100 score on automation keywords, impact, and ATS formatting.
QA Cover Letter Generator
A tailored 3-paragraph QA cover letter from your resume and a job post.
QA Application Tracker
Drag-and-drop kanban to track every QA application from Applied to Offer.
QA Take-Home Test Generator
A realistic take-home assignment with a scenario, tasks, and a rubric.
QA LinkedIn Headline Generator
A recruiter-searchable headline, About section, and skills list.
QA STAR Story Builder
Structure a QA behavioral answer with the STAR method and instant checks.
QA Bug Report Generator
Build a clean, reproducible bug report for Markdown, Jira, or plain text.
Boundary Value Analysis Generator
Generate boundary value and equivalence partitioning test cases from a range.
QA Metrics Calculator
Calculate DRE, defect leakage, defect density, and pass rate with interpretation.
QA Test Plan Generator
Build a structured test plan (scope, approach, criteria, risks) in Markdown.
Ready to Ace Your QA Interview?
Practice explaining gherkin and other key concepts with our AI interviewer.
Join 1,200+ QA engineers already practicing with AssertHired.
Start your free QA interview