Definitions of stuff used in tests → Mock Terminology
Test Double is the generic term, the phylum for all our species of testing dopplegangers.
Stub - An object that returns a specific, fixed value to the system under test (SUT). Stubs are usually constrained to a small subset of methods defined on a collaborating class. “When someone calls the price method, return the value 9.99.”
Fake - An object that completely emulates its production equivalent. The classic example of a fake is a lightweight, in-memory “database” object that allows for simple, fast emulation of a relational database interface.
Mock - An object that self-verifies. A mock asserts that information sent to it is as expected. A test that uses a mock defines and verifies this expectation.
Partial mock - An object that contains a mixture of production method implementations and mock method implementations. Partial mocks are generally used when you need to emulate non-existent behavior (i.e. abstract methods) or troublesome behavior defined on the same class you are testing, something that might indicate questionable design.
Spy - An object that simply captures messages sent to it, so that the test can later verify that the SUT interacted correctly with its collaborator.