liveBook · Manning

Gherkin test

As explained in Claude at Work

A Gherkin test is a behavior-focused acceptance test expressed as a structured natural-language scenario.

A Gherkin test describes expected behavior as a user-focused scenario. Its Given–When–Then structure states the initial conditions, an action, and the expected outcome. Testers and developers can use this shared vocabulary to agree on behavior before turning scenarios into executable tests. section 6.2

Listing 6.1 The BDD approach — sending a message described as a Gherkin scenario
Feature: Real-time message delivery

  Scenario: A message reaches another member live
    Given Ada and Grace are both viewing the "general" channel
    When Ada sends a message "deployment is green"
    Then Grace sees "deployment is green" without reloading

This scenario specifies live message delivery without prescribing how it is implemented. section 6.2

Write and review scenarios before building a feature. Check whether they capture the intended behavior, including edge cases and missing scenarios. AI can draft the files, but a person should iterate on them and explicitly approve them before implementation starts. section 6.2 section 6.6

For each manageable feature slice:

  • Write the .feature scenarios, then stop and wait for approval. Revise them when the expected behavior needs clarification. section 6.6
  • Run the scenarios and check that they fail for the right reason, such as a missing step or endpoint, rather than a broken test harness. section 6.6
  • Build until the scenarios pass; fix the implementation rather than changing a scenario to fit it. section 6.6
  • Deploy the slice, run its unit tests and BDD suite, and use the scenarios to guide exploratory testing. section 6.11

How Claude at Work covers it

How deep it goes
Explains Given–When–Then and a review-to-test workflow, while noting that the full syntax is richer.
Examples
Illustrates live message delivery between channel members and organizes messaging features into reviewable vertical slices.
What you can do after
Practice reviewing scenarios, approving behavior, and validating implemented slices against the BDD suite.
How it connects
Connects Gherkin tests to behavior-driven development, acceptance testing, unit tests, and exploratory testing.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Claude at Work. The section links point to the parts of the book it draws on.