What is test double?

Definition

It can return prepared responses, record calls or simulate selected conditions in place of a service or dependency. This helps isolate the part of a system being examined.

The substitute covers only the behavior it models. Tests using it need to be complemented by appropriate checks that the real integration behaves as expected.

ELI5

Think of using a stand-in during a rehearsal so one part of a performance can be practiced in a controlled way.

For example, a test can replace a remote tool with a prepared response to reproduce the exact condition that caused an agent to fail.

Is every test double a mock?

No. Mock is one commonly used kind or label, while test doubles can serve several different substitution roles.

Does passing a test with a substitute prove the live service works?

No. The real service and interface still need suitable integration verification.

  1. Susheem Koul and Tisha Chawla beside the words Replay Agent Failures
  2. Hamza Tahir is shown beside the blue-and-white headline CHECKPOINT THEN COMPARE on a black background.
  3. Gabriel Spencer-Harper beside the headline Verify AI Code
Definition card for test double: What is test double?

A test double is a substitute for a real component used to control or observe behavior during a test.