liveBook · Manning

Chapter 15: Mise-en-scène patterns for layering the automation codebase

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

The introduction explains why a growing scenario-automation codebase needs clear responsibilities and why the WIMP team adds some REST API scenarios to its direct-code tests.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The introduction explains why a growing scenario-automation codebase needs clear responsibilities and why the WIMP team adds some REST API scenarios to its direct-code tests.

Key terms: responsibilities, step definitions, test-code quality, service class methods, outer layer, REST API interface, fast feedback

15.1 Automating though an outer interface

This section explains how automated scenarios can call an application through its REST API, how to host and reach the application during tests, and when asynchronous test code is useful.

Key terms: outer interface, application host, dedicated application host, externally hosted application, self-hosting, public API, Isolated scenario principle, hooks, WimpAppHost, AppHostingContext

15.2 Test Driver pattern: separating automation logic

This section explains how Test Drivers separate automation details from step definitions so scenarios can reuse application interactions without exposing interface-specific code.

Key terms: testing concern, automation concern, system-under-test, layered automation code architecture, step definitions, drivers, testing decisions, automation responsibility, Test Driver, AuthenticationApiDriver

15.3 Infrastructure Layer pattern: separate infrastructure code

This section shows how the Infrastructure Layer pattern moves repeated technical plumbing out of test drivers, leaving each layer with a clearer responsibility.

Key terms: Infrastructure Layer pattern, test layer, automation layer, infrastructure layer, drivers, RestApiContext, GetRequest, ProcessRequest, bearer token, status code

15.4 Test Action pattern: simplified management of test actions

The section shows how the Test Action pattern separates repeated logging and timing from REST API actions while keeping actions easy to use and reuse.

Key terms: Test Driver, test action, cross-cutting, non-functional concerns, test action base class, DoExecute, TResult, VoidReturn, driver, step definitions, LambdaAction

15.5 Attempt Action pattern: when failure is allowed

This section explains how the Attempt Action pattern captures an action’s outcome for a later Then step to assess, while ordinary action execution still fails immediately.

Key terms: Attempt Action, When, Then, exceptional cases, negative scenarios, AttemptExecute, TestAction, TestActionResult, try-catch, happy path

15.6 Polymorphic Driver pattern: reuse driver interfaces

This section explains how technology-agnostic test drivers let one set of BDD scenarios run through different application interfaces, with drivers selected per test run or per scenario.

Key terms: BRIEF principles, business language, application interface, Polymorphic Driver pattern, Test Driver interfaces, test actions, automation interface, step definitions, IAuthenticationDriver, dependency injection

15.7 Stub Dependency pattern: stubbing an external service

This section explains how the Stub Dependency pattern makes slow or hard-to-control external services replaceable during scenario automation, using a time service as its example.

Key terms: Stub Dependency pattern, external service, ITimeService, stub, DI configuration, inner interface, outer interface, application framework, StubTimeService, driver

15.8 Related patterns

This section connects the chapter’s automation patterns to the need for maintainable BDD automation in real-world applications and introduces two related patterns for later discussion.

Key terms: BDD automation codebases, multiple interfaces, external dependencies

15.8.1 Hexagonal Architecture pattern

This section explains how hexagonal architecture separates business logic from external services through ports and adapters, making BDD automation easier to configure and test.

Key terms: Hexagonal Architecture, Ports and Adapters, core business logic, ports, adapters, inbound ports, outbound ports, Polymorphic Driver pattern, Stub Dependencies pattern, stub implementation

15.8.2 Screenplay pattern

The section explains Screenplay’s actor-centered model for automated tests, relates its concepts to BDD automation code, and identifies when its stronger actor model is useful.

Key terms: actor, ability, tasks, interactions, questions, scenario steps, step definitions, scenario context, driver methods, test actions

15.9 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 14: Prop cupboard patterns for managing input test data Chapter 16: Outline patterns that support higher-level steps →

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.