Chapter 20Fixture Setup Patterns

Patterns in This Chapter

Fresh Fixture Setup

      In-line Setup 408

      Delegated Setup 411

            Creation Method 415

      Implicit Setup 424

Shared Fixture Construction

      Prebuilt Fixture 429

      Lazy Setup 435

      Suite Fixture Setup 441

      Setup Decorator 447

      Chained Tests 454

In-line Setup

How do we construct the Fresh Fixture?

Each Test Method creates its own Fresh Fixture by calling the appropriate constructor methods to build exactly the test fixture it requires.


To execute an automated test, we require a text fixture that is well understood and completely deterministic. We can ...

Get xUnit Test Patterns: Refactoring Test Code now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.