Skip to content

Origin

The term "fake" as a test double was formalised by Meszaros (2007) and Fowler (2007) to describe the double that behaves, in contrast to doubles that only answer or assert.

Before the 2000s, the vocabulary was loose: developers said "mock" for everything, "stub" for anything that returned data, and "fake" for the production substitute in integration tests. Meszaros' book codified the five-double taxonomy (dummy, stub, spy, mock, fake), and Fowler's article popularised it in the agile/XP community. The fake got its own name because it was doing something no other double could: it replaced a collaborator with a functionally equivalent but simplified implementation.

  1. 2000s — Early testing frameworks blur "mock" and "fake"

  2. 2007 — Meszaros formalises Fake as one of five doubles

  3. 2007 — Fowler's Mocks Aren't Stubs cements the taxonomy

  4. 2010s — H2, SQLite in-memory, WireMock popularise fakes at scale

  5. 2019 — MSW (Mock Service Worker) brings fakes to the browser

  6. 2024 — "Testcontainers" offers real containers as an alternative to fakes

Fakes have working implementations, but usually take some shortcut which makes them not suitable for production.

— Martin Fowler, *Mocks Aren't Stubs*, 2007
2007 · Meszaros y Fowler formalizan el fake
5 · dobles de pruebadummy, stub, spy, mock, fake
1 · fake por test típico (in-memory DB, wire server, clock)
2-3× · mantenimiento más caro que un mock (fake = código productivo en tests)