Development Methods & Design

Test Double

English

Overview

An umbrella term for techniques that replace an external element a test subject depends on with a stand-in built for testing.

Details

The name comes from a movie "stunt double." Test doubles are categorized into several types depending on how they replace the real thing—a "stub" that simply returns a value, a "mock" that records whether it was called, and so on. They're used to test code that depends on an external API or database quickly and reliably, without actually invoking the real thing.

More Programming terms