Appendix B. Pattern catalog
The pattern catalog presents a practical toolkit for writing and supporting behavior-driven scenarios, organized around common needs in scenario design, automation structure, data handling, setup, and diagnostics. At its core, it emphasizes keeping scenarios readable and business-oriented while still giving teams ways to share context safely, introduce and reference entities clearly, select items from collections, and manage domain terminology consistently. It also highlights approaches for building reusable test data and validation helpers, such as defaults, factories, builders, table accessors, and specialized assertion support, all aimed at reducing duplication and keeping step definitions focused on intent rather than plumbing.
A second major theme is structuring the automation layer so that tests remain maintainable as systems and test suites grow. The catalog describes patterns for hiding technical complexity behind drivers, infrastructure adapters, and test actions, while also supporting more advanced execution needs like alternate interfaces, expected failures, and stubs for hard-to-control dependencies. In the same spirit, it offers ways to simplify scenario setup with shared resources, shortcuts, implicit prerequisites, and approval-style checks, while preserving clarity and keeping the behavior under test visible in the scenario narrative.
The remaining patterns focus on reliability, flexibility, and diagnosability across the test lifecycle. They cover repeatable environment management through resets, seeded data, and selective cleanup; configurable execution through providers, parameterization, and scenario-specific behavior; and staging techniques for shared infrastructure, resource pools, and file-system-dependent tests. The catalog also stresses fast failure analysis through descriptive assertions, supplementary attachments, test logs, embedded application logs, and corroboration checks. Overall, the chapter serves as a catalogue of proven design choices for making BDD suites expressive, resilient, and efficient without sacrificing communication with the business.
Effective Behavior-Driven Development ebook for free