liveBook · Manning

Chapter 14: Prop cupboard patterns for managing input test data

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

This introduction explains why scenario automation needs ways to supply input test data without cluttering scenarios with incidental details.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This introduction explains why scenario automation needs ways to supply input test data without cluttering scenarios with incidental details.

Key terms: essential principle, incidental details, automation code, Prop Cupboard pattern language, input test data, scenario’s context, props

14.1 Domain Default pattern for managing default test data

This section explains how the Domain Default pattern keeps incidental test data out of scenarios while making automation defaults consistent and easy to change.

Key terms: default test data, scenario, incidental detail, Domain Default pattern, DomainDefaults, default test values, step definitions, DomainDefaults class, documentation, whole entities

14.2 Default Instance pattern: use defaults, but…

This section explains how the Default Instance pattern creates customizable test data from shared defaults without duplicating object construction across step definitions.

Key terms: Default Instance pattern, factory method, DomainDefaults, step definition, default instance, generator function, object structure, outside perspective, test data, denormalized structures

14.3 Object Mother pattern: generate complicated test data structures

This section explains how Object Mothers build customized default test data and object hierarchies, and when their added abstraction is worthwhile.

Key terms: Object Mother, Default Instance pattern, overwrite instructions, object structure, Domain default pattern, fluent interfaces, configuration instruction methods, traditional interface style, mutable, immutable

14.4 Terminology Promotion pattern: expressing domain-specific data

This section shows how custom parameter types let scenarios use business terminology while keeping conversion logic out of individual step definitions.

Key terms: {string}, PizzaSize, built-in parameter conversion, {PizzaSize}, Terminology Promotion pattern, custom parameter type, {pizza-size}, Business language principle, domain-specific language, order service

14.5 Data Table Accessor pattern: handling data table parameters

This section explains how the Data Table Accessor pattern turns scenario data tables into typed test data while keeping conversion and optional-column handling out of step definitions.

Key terms: data tables, step definitions, optional columns, typed data structure, MenuItemData, MenuItem, conversion logic, optional types, DomainDefaults, default values

14.6 Data Table Assertion pattern: asserting with data tables

This section explains how a single data-table assertion can simplify Then steps and make failures easier to diagnose.

Key terms: Data Table Assertion pattern, Then step, CompareToSet, atomic assertion, diff, expected result, actual result, CreateSet, diff calculator, omitted column

14.7 Validation Tester pattern: specifying and automating data validation

This section explains how the Validation Tester pattern uses default instances and focused scenarios to specify and automate data validation rules without duplicating test data.

Key terms: Validation Tester pattern, default instance, scenario outline, examples table, When step, step definition, overwrites, FillInstance, data table, multi-field validation

14.8 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 13: Spotlight patterns for automating narrative flow Chapter 15: Mise-en-scène patterns for layering the automation codebase →

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.