To summarize:
- Test Double is a generic term for any test object that replaces a production object.
- Dummy objects are passed around but not actually used. They are usually fillers for parameter lists.
- Fakes have working implementations, but take some shortcut (e.g., InMemoryDatabase).
- Stubs provide canned answers to calls made during a test.
- Mocks have expectations which form a specification of the calls they do and do not receive.
Instead of actually connecting to a database and reading information, a stub just returns the results you'd expect, or simulates a failure; and so forth.
No comments:
Post a Comment