liveBook · Manning

Chapter 16: Outline patterns that support higher-level steps

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

The introduction explains the tension between keeping scenarios concise and automating the mechanical details needed for complex behavior.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The introduction explains the tension between keeping scenarios concise and automating the mechanical details needed for complex behavior.

Key terms: formulation, high-level scenarios, mechanical details, scenario automation, BRIEF scenarios

16.1 Scenario Resource pattern: managing test resources

This section explains how the Scenario Resource pattern manages per-scenario test resources, including selective startup, hook ordering, access from tests, and a dependency-injection alternative.

Key terms: Scenario Resource pattern, test resources, scenario-lifetime, application host, payment gateway, tags, hook tag expressions, direct or inherited tags, CombinedTags, Order property

16.2 Context Shortcut pattern: bring the application to the expected state

This section explains how Context Shortcuts speed up complex Given-step setup while preserving the reliability and boundaries of scenario tests.

Key terms: intention-revealing steps, Given steps, test actions, Context Shortcut pattern, Given step, When step, application state, programmer tests, inconsistent application state, data-handling infrastructure

16.3 Ensure pattern: managing implicit dependencies

This section explains how the Ensure pattern supplies implicit functional prerequisites during automation without cluttering scenarios or replacing prerequisites they specify explicitly.

Key terms: implicit context, functional prerequisites, Given step, Ensure pattern, EnsureOrderPlaced, OrderingContext, explicit Given step, default order, shareable scenario context, ensure method

16.4 Approved Outcome pattern: atomic handling of complex assertions

The section shows how the Approved Outcome pattern makes complex scenario expectations more readable by comparing a printable result with an approved one.

Key terms: Then steps, Approved Outcome pattern, atomic assert, approval testing, approved result, snapshot testing, printer, text diff, printed result, docstring

16.5 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 15: Mise-en-scène patterns for layering the automation codebase Chapter 17: Dramatis personae patterns for clear naming of concepts →

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.