liveBook · Manning

Chapter 8: Formulating a feature

What you will learn in chapter 8 of Effective Behavior-Driven Development

Introduces feature files as Gherkin’s way of grouping related scenarios into readable documentation.

After this chapter you will be able to

What it builds on

Section by section

Introduction

Introduces feature files as Gherkin’s way of grouping related scenarios into readable documentation.

Key terms: Gherkin, feature file, scenarios, cohesive

8.1 A sample feature file

This section introduces a feature file containing scenarios derived from the previous chapter’s example map.

Key terms: example map, scenarios, feature file

8.2 Gherkin basics

Introduces Gherkin as a simple language designed to make documentation readable to people and processable by automation tools.

Key terms: Gherkin, natural language, automation tools

8.2.1 Keywords

This section distinguishes Gherkin block and step keywords and explains what each keyword contributes to a feature file.

Key terms: block keywords, step keywords, Feature, Background, Rule, Scenario, Scenario Outline, Examples, Given, When

8.2.2 Non-English language support

Gherkin supports readable, automatable documentation in many languages and encourages teams to use their organization’s business language.

Key terms: Gherkin keywords, business language, variants

8.2.3 Strict reading of the text

This section explains why automated scenarios require consistent spaces, punctuation, and capitalization.

Key terms: scenarios, automation, Scenario:, Given

8.3 The structure and syntax of a feature file

This section explains how a Gherkin feature file begins, what its Feature block can contain, and why teams must maintain descriptive text themselves.

Key terms: Feature keyword, Feature block, feature file, feature description, Rule keyword, scenario automation tools, living documentation

8.3.1 Rules

This section explains how Gherkin Rule blocks connect discovery rules to the scenarios that illustrate them.

Key terms: Rule keyword, Rule block, scenarios, feature file

8.3.2 Scenario structure

This section explains how a Gherkin scenario turns a discovery example into named steps that illustrate a rule, and why outcome wording should fit the organization.

Key terms: Scenario, Rule, discovery, Given, When, Then, steps, context, triggering action, should

8.3.3 Multiple contexts

This section explains how to express multiple essential pieces of scenario context clearly and when a crowded context step should prompt a closer look at the domain.

Key terms: Given, And, context, rule, conjunction, context step, domain abstraction

8.3.4 Keeping context essential

This section explains how to keep scenario context focused on the rule being illustrated, even when implementation requires additional setup.

Key terms: context steps, specific rule, implicit context, essential principle, inessential details, brittle, ease of maintenance, ease of automation

8.3.5 Is it a Given or a When?

This section shows how to distinguish a scenario’s triggering action from its context by identifying which action directly produces the expected outcome.

Key terms: context, Given, When, Then, triggering action, single When step, enabling constraint

8.3.6 Multiple outcomes

This section explains when a focused scenario can have multiple outcomes and how to review conjunctions in scenario steps.

Key terms: focused principle, BRIEF, Then, single rule, multiple outcomes, or, non- determinism, scenario, and, But

8.4 Gherkin tables

Introduces Gherkin tables as optional ways to make feature files easier for everyone to read.

Key terms: Gherkin, feature files, data tables, examples tables

8.4.1 Data tables

This section explains how Gherkin data tables make structured information readable and how step wording can connect a table to its preceding step.

Key terms: data tables, step, two-dimensional grid, data table, colon, incomplete sentence

8.4.2 Scenario outlines and examples tables

This section explains how examples tables expand scenario outlines into multiple scenarios and how they can make similar examples easier to read.

Key terms: scenario outline, examples table, Examples keyword, parameter placeholders, Scenario Outline keyword, Scenario, Examples block, description column, parameter placeholder

8.4.3 Data variations

Explains when data variations suit scenario-outline tables and why each example row must earn its place.

Key terms: data variations, scenario outlines, examples tables, data-driven validation, example rows, scenario outline, automation

8.4.4 Similar wording

This section explains when a scenario outline can make similar scenarios easier to read and why teams should not use one by default.

Key terms: scenario outline, simple scenarios, Gherkin

8.4.5 Keep tables readable

This section explains how to keep Gherkin tables readable by limiting their size and aligning their columns.

Key terms: data tables, examples tables, scenario outline, separators (“|”), columns, IDEs

8.5 Readable blocks of text

This section explains how Gherkin docstrings keep multiline text readable and how AI can provide review feedback on scenarios.

Key terms: Gherkin, docstring, preceding step, whitespace, AI reviews, readability, consistency, product owner

8.6 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 7: Cleaning up an old scenario Chapter 9: A new user story →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.