liveBook · Manning

Chapter 18: Dress rehearsal patterns for building confidence

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

The introduction explains why teams should regularly run scenarios against real services as well as stubs, while recognizing the feedback and reliability challenges this creates.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The introduction explains why teams should regularly run scenarios against real services as well as stubs, while recognizing the feedback and reliability challenges this creates.

Key terms: integration testing, stubs, dress rehearsals, continuous integration, speed of feedback, test results, external datasets, external, shared resources

18.1 Challenges of using real databases for test execution

Explains how baseline data, test-data choices, isolation, repeatability, and reset costs shape an automation strategy that uses a real database.

Key terms: baseline, clean start, seeded, snapshot, insert, query, hardcode, test data management, isolation, serial execution

18.2 Reset Before pattern: reset database before scenario execution

Explains how resetting persistent test data before each scenario makes executions repeatable while leaving failed-run data available for diagnosis.

Key terms: real database, repeatability, scenario executions, Reset Before pattern, BeforeScenario hook, database reset, clean, known state, after-scenario hook, residual data, debugging

18.3 Clean Start pattern: start each scenario with an empty database

This section explains how the Clean Start pattern gives each database-backed scenario an empty starting point and why fast, generic database emptying is preferable to recreating the database.

Key terms: Clean Start pattern, blank slate, baseline data, avalanche-effect, TRUNCATE TABLE, foreign key checks, ResetDatabase, batch delete, delete-triggers, foreign key constraints

18.4 Seeded Data pattern: share common data across scenario executions

This section explains how carefully chosen seed data can simplify scenarios that use a real database while preserving a way for scenarios with different data requirements to set up their own context.

Key terms: Seeded Data pattern, Clean Start pattern, seed data, foreign key constraint, Given step, step definition, @no-menu-seed-data, data access layer, low-level SQL

18.5 Skippable Reset pattern: do not reset database after read-only scenario executions

This section explains how the Skippable Reset pattern speeds scenario execution by omitting database reset work when reliable change detection shows it is unnecessary.

Key terms: Skippable Reset pattern, baseline, partial database reset, re-seeding, change detection, read-only, false test errors, timestamps, data access library events, log events

18.6 Patterns for snapshot databases

This section explains why some BDD scenarios must use snapshot databases despite the maintenance problems those datasets create.

Key terms: test-first approach, snapshot databases, legacy applications, hardcoded entities, test data ownership

18.6.1 Undo Changes pattern: only reset modified data

This section explains when to use the Undo Changes pattern and how to restore a database baseline by recording and reversing scenario changes.

Key terms: Undo Changes pattern, baseline data, Seeded Data, Skippable Reset, change journal, reset database before-scenario hook, reverse operation, baseline, data access library, ORM tool

18.6.2 Entity Finder pattern: find suitable data instead of creating it

This section explains how the Entity Finder pattern uses existing snapshot-baseline data to set up scenarios, and why that shortcut needs careful safeguards.

Key terms: Entity Finder pattern, snapshot baseline, Given step definitions, prerequisite entities, search criteria, baseline database versions, backup plan, automated entity creation, flaky tests, baseline database

18.7 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 17: Dramatis personae patterns for clear naming of concepts Chapter 19: Technical note patterns for quick error recovery →

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.