Backend & systems·Testing and test doubles
you swap the real collaborator for a stand-in, because the real one is slow, remote, or has side effects you cannot have in a test.
Test double
The umbrella term for any object substituted for a real dependency in a test: stubs, mocks, fakes and spies are all test doubles. Naming the specific kind matters because they answer different questions — some make a test possible, others make an assertion. Calling everything a mock is why test reviews go in circles.