" The vocabulary for talking about this soon gets messy - all sorts of words are used: stub, mock, fake, dummy. "
Test Double the generic term for any kind of pretend object used in place of a real object for testing purposes.
five particular kinds of double (1) Dummy objects passed around but never actually used. eg. fill parameter lists
(2) Fake objects working implementations shortcut which makes them not suitable for production eg. in memory database
(3) Stubs provide canned answers to calls made during the test Does not respond to anything outside what’s programmed in for the test.
(4) Spies stubs that also record some information based on how they were called. eg. email service that records how many messages it was sent
(5) Mocks objects pre-programmed with the calls they are expected to receive
only mocks insist upon behavior verification. The other doubles can, and usually do, use state verification.
(src: Article: Mocks Aren’t Stubs - Martin Fowler) (ref: TestDouble) (origin: Book: xUnit Test Patterns - Gerard Meszaros)