AI Space

DevOps & Tooling / Knowledge library

Test Double

Substitutes a dependency with a controlled fake, stub, spy, or mock

Software testing technique

Why learn Test Double?

It makes tests deterministic and able to exercise hard-to-produce conditions

The problem it solves

It isolates behavior from slow or unavailable collaborators

Where it came from

Test Double is a software testing technique that substitutes a dependency with a controlled fake, stub, spy, or mock. Its guarantees and tradeoffs depend on the concrete implementation and operating context.

Build your understanding

Work through these exercises in order. Try the task before opening a reference.

  1. Define Test Double and distinguish it from a neighboring concept.
  2. Choose a realistic task where Test Double is appropriate.
  3. Identify a failure mode caused by misusing Test Double.
  4. Interpret a small design or result involving Test Double.
  5. Explain one tradeoff or limitation of Test Double.

Documentation and sources

Connect the ideas

Explore next

Unit TestingDependency Injection

Catalog source: technology-maxxing. This page reproduces the existing catalog’s learning material and source links.