liveBook · Manning

Chapter 13: Spotlight patterns for automating narrative flow

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

This introduction explains why automated scenario steps should work together to preserve a focused business narrative.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This introduction explains why automated scenario steps should work together to preserve a focused business narrative.

Key terms: step definition, scenario execution, Local Scenario Context, Shareable Scenario Context, business narrative, spotlight, essential details, expected outcome

13.1 Local Scenario Context pattern: learning to remember

This section explains how Local Scenario Context lets steps in the same glue code class remember information without repeating it in the scenario or sharing it with other executions.

Key terms: Local Scenario Context, step definition, instance field, glue code class, scenario context, scenario execution context, world, instance fields, static fields, context-independent

13.2 Shareable Scenario Context pattern: sharing data between step definitions in different classes

This section explains how Shareable Scenario Context lets step definitions in different classes share information during one scenario without leaking it into another.

Key terms: Shareable Scenario Context, step definition, context class, instance fields, scenario isolation, dependency injection, scenario lifetime scope, constructor injection, property injection, scenario context

13.3 Introduce and Refer pattern: separating introduction and reference

This section explains how the Introduce and Refer pattern keeps a scenario’s wording and automation aligned when an entity first appears and is mentioned again.

Key terms: Introduce and Refer pattern, entity, introduction, reference, scenario context, step definition, authenticated customer, indefinite article, introduction step, Cucumber Expression

13.3.1 What about “they”?

This subsection explains how to use pronouns in scenario steps while keeping step definitions matchable and unambiguous.

Key terms: custom parameter types, Cucumber Expression alternations, multiple expressions, they, generic reference terms, context insensitive, ambiguous, it

13.3.2 Referring to more than one entity?

Explains how a step definition can support references to one order in a single-order scenario and distinguish orders in a multi-order scenario.

Key terms: the order, the completed order, scenario context, CurrentOrder, CompletedOrder

13.4 Entity Selector pattern: selecting entities by phrases

This section explains how the Entity Selector pattern keeps scenarios readable by resolving phrases such as “the earliest order received” to an entity through selection logic.

Key terms: Entity Selector pattern, Introduce and Refer pattern, entity selectors, scenario context, {order} custom parameter type, [StepArgumentTransformation], ConvertEarliestOrder, step definition, scenario readability, dedicated unit tests

13.5 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 12: Getting ready for scenario automation Chapter 14: Prop cupboard patterns for managing input test data →

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.