Gherkin Game

Gherkin Learning Game

Master Behavior-Driven Development syntax through interactive challenges

Score
0
Levels
0/27
Streak
0x
Achievements
0/10
What is Gherkin?

Gherkin is a simple, plain-text language that helps business analysts, product owners, and developers communicate about software requirements. Think of it as a structured way to describe how your software should behave in real-world scenarios.

Why Use Gherkin?

  • Clear Communication: Everyone understands the same requirements
  • Living Documentation: Requirements that stay up-to-date with your software
  • Automated Testing: Turn requirements into executable tests
  • Reduced Ambiguity: Structured format prevents misunderstandings

Basic Building Blocks:

Feature
High-level description

Describes what functionality you're building and why it matters to users

Scenario
Specific example

A concrete example of how the feature should work in a particular situation

Given
Initial context

Sets up the starting conditions - what's already true before the action

When
Action or event

The specific action that triggers the behavior you want to test

Then
Expected outcome

What should happen as a result - the expected behavior or outcome

Advanced Concepts:

And/But
Additional conditions

Adds more conditions or shows contrasting expectations

Background
Common setup

Shared steps that run before each scenario in a feature

Scenario Outline
Data-driven tests

Run the same scenario with different data sets using placeholders

Examples
Test data tables

Provides the data sets for Scenario Outline in table format

Real-World Example:

Feature: Online Shopping Cart
As a customer, I want to add items to my cart so I can purchase them later

Scenario: Adding an item to an empty cart
Given I am on the product page
And my cart is empty
When I click "Add to Cart"
Then the item should be added to my cart
And the cart count should show "1"
Basics
Foundation concepts
Feature, Scenario, Given-When-Then
And/But
Extend your scenarios
Chain conditions and contrasts
Background
Shared setup steps
Common preconditions
Data Tables
Scenario Outlines
Data-driven testing
Master
Real-world scenarios
Professional scenarios