Repaso
Español
TestingIntermediateTST-04

An in-memory UserRepository that stores users in a dict and behaves like the real one is called a…

Options

  1. Mock
  2. Stub
  3. Fake (Correct option)
  4. Spy

Answer

Fake

Why

These are all 'test doubles', stand-ins for real dependencies:

  • Fake: a simple but WORKING implementation (in-memory repository, fake email sender that stores messages in a list).
  • Stub: returns fixed answers ('always return this user').
  • Mock: pre-programmed and later checked: 'was send() called once with these arguments?'.
  • Spy: wraps a real object and records how it was called.

Remember

Fake = working lightweight version of the real thing.

Key terms

Practice this question in Repaso