Hosted by:
Unit testing expertise at your fingertips!
Home | Discuss | Lists
All Categories
Introductory Narratives
Web Site Instructions
Code Refactorings
Cross References & Lists
Database Patterns
DfT Patterns
External Patterns
Fixture Setup Patterns
Fixture Teardown Patterns
Front Matter
Result Verification Patterns
Test Double Patterns
Test Organization
Test Refactorings
Test Smells
Test Strategy
Value Patterns
XUnit Basics
xUnit Members
All "Cross References & Lists"
List of Patterns
List of Patterns
Assertion Message(XXX):We include a descriptive string argument in each call to an Assertion Method. Includes Argument Describing Message, Assertion Identifying Message, Expectation Describing Message.
Assertion Method(XXX):Call a utility method to evaluate whether an expected outcome has been achieved. Includes Equality Assertion, Expected Exception Assertion, Fuzzy Equality Assertion, Single Outcome Assertion, Stated Outcome Assertion.
Automated Teardown(XXX):We keep track of all resources that are created in a test and automatically destroy/free them during teardown. Includes Automated Exercise Teardown, Automated Fixture Teardown, Test Object Registry.
Back Door Manipulation(XXX):We set up the test fixture or verify the outcome by going through a back door (such as direct database access.) Includes Back Door Setup, Back Door TearDown, Back Door Verification, Data Loader, Data Retriever, Database Extraction Script, Database Population Script, Layer-Crossing Test, Test Doubles.
Behavior Verification(XXX):We capture the indirect outputs of the SUT as they occur and compare them to the expected behavior. Includes Expected Behavior, Expected Behavior Specification, Interaction Testing, Procedural Behavior Verification.
Chained Tests(XXX):We let the other tests in a test suite set up the test fixture. Includes Fixture Setup Testcase.
Configurable Test Double(XXX):Configure a reusable Test Double with the values to be returned or verified during the fixture setup phase of a test. Includes Configurable Mock Object, Configurable Test Spy, Configurable Test Stub, Configuration Interface, Configuration Mode, Dynamically Generated Test Double, Hand-Built Test Double, Statically Generated Test Double.
Creation Method(XXX):Set up the test fixture by calling methods that hide the mechanics of building ready-to-use objects behind Intent Revealing Names. Includes Anonymous Creation Method, Attachment Method, Named State Reaching Method, Parameterized Anonymous Creation Method, Parameterized Creation Method, Reuse Test for Fixture Setup.
Custom Assertion(XXX):Create a purpose-built Assertion Method that compares only those attributes of the object that define test-specific equality. Includes Bespoke Assertion, Custom Assertion Test, Custom Equality Assertion, Diagnostic Assertion, Domain Assertion, Object Attribute Equality Assertion, Verification Method.
Data-Driven Test(XXX):We store all the information needed for each test in a data file and write an interpreter that reads the file and executes the tests. Includes Data-Driven Test Framework (FIT), Naive xUnit Test Interpreter, Test Suite Object Generator, Test Suite Object Simulator.
Database Sandbox(XXX):We provide a separate test database for each developer or tester. Includes DB Schema per TestRunner, Database Partitioning Scheme, Dedicated Database Sandbox.
Delegated Setup(XXX):Each test creates its own Fresh Fixture by calling Creation Methods from within the Test Methods.
Delta Assertion(XXX):We specify assertions based on differences between the pre- and post-exercise state of the SUT.
Dependency Injection(XXX):The client provides the depended-on object to the SUT. Includes Constructor Injection, Parameter Injection, Setter Injection.
Dependency Lookup(XXX):The SUT asks another object to return the depended-on object before it uses it. Includes Component Broker, Component Registry, Object Factory, Service Locator.
Derived Value(XXX):We use expressions to calculate values that can be derived from other values. Includes Calculated Values, Derived Expectation, Derived Input, One Bad Attribute.
Dummy Object(XXX):We pass an object that has no implementation as an argument of a method called on the SUT. Includes Dummy, Dummy Argument, Dummy Attribute, Dummy Parameter, Dummy Value, Placeholder, Stub.
Fake Object(XXX):Replace a component that the SUT depends on with a much lighter-weight implementation. Includes Fake Database, Fake Service Layer, Fake Web Service, In-Memory Database.
Four-Phase Test(XXX):Structure each test with four distinct parts executed in sequence.
Fresh Fixture(XXX):Each test constructs its own brand-new test fixture for its own private use. Includes Fresh Context, Persistent Fresh Fixture, Private Fixture, Transient Fresh Fixture.
Garbage-Collected Teardown(XXX):We let the garbage collection mechanism provided by the programming language clean up after our test.
Generated Value(XXX):Generate a suitable value each time the test is run. Includes Distinct Generated Value, Generated Value, Random Generated Value, Related Generated Value.
Guard Assertion(XXX):Replace an if statement in a test with an assertion that fails the test if not satisfied. Includes Shared Fixture State Assertion.
Hard-Coded Test Double(XXX):Build the Test Double by hard-coding the return values and/or expected calls. Includes Hard-Coded Mock Object, Hard-Coded Test Spy, Hard-Coded Test Stub, Inner Test Double, Loopback, Pseudo Object, Self Shunt, Test Double Class.
Humble Object(XXX):We extract the logic into a separate easy-to-test component that is decoupled from its environment. Includes Humble Container Adapter, Humble Dialog, Humble Executable, Humble Transaction Controller, Poor Man's Humble Object, Subclassed Humble Object, True Humble Object.
Implicit Setup(XXX):Build the test fixture common to several tests in the setUp method. Includes Framework-invoked Setup, Hooked Setup, Setup Method.
Implicit Teardown(XXX):The Test Automation Framework calls our clean up logic in the tearDown method after every Test Method. Includes Framework-invoked Teardown, Hooked Teardown, Teardown Method.
Inline Setup(XXX):Each Test Method creates it's own Fresh Fixture by calling the appropriate constructor methods to build exactly the test fixture it requires.
Inline Teardown(XXX):We include teardown logic at the end of the Test Method immediately after the result verification. Includes Delegated Teardown, Naive Inline Teardown, Teardown Guard Clause.
Layer Test(XXX):We write separate tests for each layer of the Layered Architecture. Includes Component Test, Layered Test, Persistence Layer Test, Presentation Layer Test, Service Layer Test, Single Layer Test, Subcutaneous Test, Testing by Layers.
Lazy Setup(XXX):We use Lazy Initialization of the fixture to create it in the first test that needs it.
Literal Value(XXX):Use literal constants for object attributes and assertions. Includes Constant Value, Hard-Coded Value, Self-Describing Value, Symbolic Constant.
Minimal Fixture(XXX):Use the smallest and simplest fixture possible for each test. Includes Minimal Test Fixture.
Mock Object(XXX):Replace an object the system under test (SUT) depends on with a test-specific object that verifies it is being used correctly by the SUT.
Named Test Suite(XXX):Define a test suite, suitably named, that contains a set of tests that we wish to be able to run as a group. Includes AllTests Suite, Single Test Suite, Subset Suite.
Parameterized Test(XXX):We pass the information needed to do fixture setup and result verification to a utility method that implements the entire test lifecycle. Includes Incremental Tabular Test, Loop-Driven Test, Tabular Test.
Prebuilt Fixture(XXX):Build the Shared Fixture separately from running the tests. Includes Global Fixture, Prebuilt Context, Test Bed.
Recorded Test(XXX):We automate tests by recording interactions with the application and playing them back using a test tool. Includes Built-In Test Recording, Capture/Playback Test, External Test Recording, Record and Playback Test, Refactored Recorded Test, Robot User Test.
Scripted Test(XXX):We automate the tests by writing test programs by hand. Includes Automated Unit Test, Hand-Scripted Test, Hand-Written Test, Programatic Test.
Setup Decorator(XXX):We wrap the test suite with a Decorator that sets up the shared test fixture before running the tests and tears it down after all the tests are done. Includes Abstract Setup Decorator, Decorated Lazy Setup, Hard-Coded Setup Decorator, Parameterized Setup Decorator, Pushdown Decorator.
Shared Fixture(XXX):We reuse the same instance of the test fixture across many tests. Includes Immutable Shared Fixture, Incremental Tests, Leftover Fixture, Per-Run Fixture, Reused Fixture, Shared Context, Slow Tests, Stale Fixture.
Standard Fixture(XXX):The same design of test fixture is used in several tests. Includes Standard Context.
State Verification(XXX):We inspect the state of the SUT after it has been exercised and compare it to the expected state. Includes Expected Object, Expected State Specification, Procedural State Verification, State-based Testing.
Stored Procedure Test(XXX):We write Fully Automated Tests for each stored procedure. Includes In-Database Stored Procedure Test, Remoted Stored Procedure Test.
SuiteFixture Setup(XXX):We build/destroy the shared fixture in special methods called by the Test Automation Framework before/after the first/last Test Method is called.
Table Truncation Teardown(XXX):Truncate the tables modified during the test to tear down the fixture. Includes Lazy Teardown.
Test Automation Framework(XXX):We use a framework that provides all the mechanisms needed to run the test logic so the test writer only needs to provide the test-specific logic. Includes Data-Driven Test Frameworks, Robot User Test Frameworks, The xUnit Family of Test Automation Frameworks.
Test Discovery(XXX):The Test Automation Framework discovers all the tests that belong to the test suite automatically. Includes Test Method Discovery, Testcase Class Discovery.
Test Double(XXX):We replace a component on which the SUT depends with a "test-specific equivalent." Includes Imposter.
Test Enumeration(XXX):The test automater manually writes the code that enumerates all tests that belong to the test suite. Includes Direct Test Method Invocation, Test Method Enumeration, Test Suite Enumeration, Test Suite Factory.
Test Helper(XXX):We define a helper class to hold any Test Utility Methods we want to reuse in several tests. Includes Object Mother, Test Fixture Registry, Test Helper, Test Helper Object.
Test Hook(XXX):We modify the SUT to behave differently during the test.
Test Method(XXX):Encode each test as a single on some class. Includes Constructor Test, Dependency Initialization Test, Expected Exception Test, Simple Success Test.
Test Runner(XXX):Define an application that instantiates a Test Suite Object and executes all the Testcase Objects it contains. Includes Command-Line Test Runner, File System Test Runner, Graphical Test Runner, Test Tree Explorer.
Test Selection(XXX):The Test Automation Framework selects the Test Methods to be run at runtime based on attributes of the tests. Includes Test Method Selection, Testcase Class Selection.
Test Spy(XXX):Use a Test Double to capture the indirect output calls made to another component by the SUT for later verification by the test. Includes Indirect Output Registry, Loopback, Retrieval Interface, Spy, Test Spy.
Test Stub(XXX):We replace a real object with a test-specific object that feeds the desired indirect inputs into the system under test. Includes Entity Chain Snipping, Procedural Test Stub, Responder, Saboteur, Stub, Temporary Test Stub.
Test Suite Object(XXX):Define a collection class that implements the standard test interface and use it to run a set of related Testcase Objects. Includes Suite of Suites, Test Suite Procedure, Testcase Class Suite.
Test Utility Method(XXX):We encapsulate the test logic we want to reuse behind a suitably named utility method. Includes Cleanup Method, Finder Method, SUT API Encapsulation, SUT Encapsulation Method, Test Utility Test.
Test-Specific Subclass(XXX):Add methods that expose the state or behavior needed by the test to a subclass of the SUT. Includes Behavior Exposing Subclass, Behavior Modifying Subclass, Self Delegation, State Exposing Subclass, Subclassed Singleton, Subclassed Test Double, Substitutable Singleton, Substituted Singleton, Test Double Subclass, Test-Specific Extension.
Testcase Class(XXX):Group a set of related Test Methods on a single . Includes Test Fixture.
Testcase Class per Class(XXX):We put all the Test Methods for one SUT class onto a single Testcase Class.
Testcase Class per Feature(XXX):We group the Test Methods onto Testcase Classes based on which testable feature of the SUT they exercise. Includes Testcase Class Per Method, Testcase Class Per User Story.
Testcase Class per Fixture(XXX):We organize Test Methods into Testcase Classes based on commonality of the test fixture.
Testcase Object(XXX):We create a Command object for each test and call the run method when we wish to execute it.
Testcase Superclass(XXX):We inherit reusable test-specific logic from an abstract . Includes Abstract Test Fixture (in .Net), Abstract Testcase, Test Helper Mixin.
Transaction Rollback Teardown(XXX):We rollback the uncommitted test transaction as part of the teardown.
Unfinished Test Assertion(XXX):We ensure that incomplete tests fail by executing an assertion that is guaranteed to fail.