Model: 5 kinds of test doubles
September 2nd, 2022
The vocabulary for talking about this soon gets messy - all sorts of words are used: stub, mock, fake, dummy.
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
shortcut which makes them not suitable for production
eg. in memory database
provide canned answers to calls made during the test
Does not respond to anything outside what's programmed in for the test.
stubs that also record some information based on how they were called.
eg. email service that records how many messages it was sent
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.