Most asked top Interview Questions and Answers & Online Test
Education platform for interview prep, online tests, tutorials, and live practice

Build skills with focused learning paths, mock tests, and interview-ready content.

WithoutBook brings subject-wise interview questions, online practice tests, tutorials, and comparison guides into one responsive learning workspace.

Chapter 2

Gherkin Syntax, Features, Scenarios, Given When Then, and Writing Clear Examples

Learn the language of Cucumber so you can write readable, useful, and maintainable behavior specifications.

Inside this chapter

  1. What Gherkin Is
  2. Simple Example
  3. How to Think About Given When Then
  4. Writing Good Scenarios

Series navigation

Study the chapters in order for the clearest path from beginner BDD concepts to advanced automation architecture. Use the navigation at the bottom of each page to move through the full tutorial series.

Tutorial Home

Chapter 2

What Gherkin Is

Gherkin is the domain-specific language used by Cucumber to describe system behavior. It is intentionally simple and human-readable so stakeholders can discuss scenarios even if they do not write application code. The most common keywords are Feature, Scenario, Given, When, Then, And, and But.

Chapter 2

Simple Example

Feature: Login

  Scenario: Valid user signs in successfully
    Given the user is on the login page
    When the user enters valid credentials
    Then the dashboard should be displayed

This format is small, but it already captures business intent in a way that both humans and automation can work with.

Chapter 2

How to Think About Given When Then

  • Given: the starting context or precondition
  • When: the action or event
  • Then: the expected outcome

Strong BDD writing keeps each scenario focused on one behavior. If the scenario becomes too long, it is often describing too much at once.

Chapter 2

Writing Good Scenarios

Good scenarios are concrete, user-focused, and outcome-driven. They avoid implementation noise such as button IDs, CSS selectors, or internal system details unless those details are truly part of the business behavior. The scenario should communicate intent first, not automation mechanics.

Copyright © 2026, WithoutBook.