Skip to content

The five doubles

The mock is one of five test doubles defined by Gerard Meszaros; it is the only one that verifies behaviour by default.

graph TD
  TD[Test Double] --> D[Dummy: passed but never used]
  TD --> S[Stub: canned answers]
  TD --> SP[Spy: records calls, you assert later]
  TD --> M[Mock: asserts expectations itself]
  TD --> F[Fake: working shortcut]