1. Dummy objects are passed around but never actually used. Usually they are just used to fill parameter lists.
2. Fake objects actually have working implementations, but usually take some shortcut which makes them not suitable for production (an in memory database is a good example).
3. Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what's programmed in for the test.
4. Spies are stubs that also record some information based on how they were called. One form of this might be an email service that records how many messages it was sent.
5. Mocks are what we are talking about here: objects pre-programmed with expectations which form a specification of the calls they are expected to receive.
Of these kinds of doubles, only mocks insist upon behavior verification. The other doubles can, and usually do, use state verification.
Resource Link: https://www.martinfowler.com/articles/mocksArentStubs.html
2. Fake objects actually have working implementations, but usually take some shortcut which makes them not suitable for production (an in memory database is a good example).
3. Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what's programmed in for the test.
4. Spies are stubs that also record some information based on how they were called. One form of this might be an email service that records how many messages it was sent.
5. Mocks are what we are talking about here: objects pre-programmed with expectations which form a specification of the calls they are expected to receive.
Of these kinds of doubles, only mocks insist upon behavior verification. The other doubles can, and usually do, use state verification.
Resource Link: https://www.martinfowler.com/articles/mocksArentStubs.html
No comments:
Post a Comment