A stub satisfies a particular interface and returnscannedanswers for every invocation to the methods it implements. Mocks allow us to specify the following in a declarative way:
The order and parameters of the expected set of method invocations
The set of values to be returned for each combination of inputs
A fake object provides a fully working implementation whose behavior matches the objects that they are meant to substitute. For example, instead of having our tests communicate with a real key-value (KV) store, we might inject a fake object that provides a compatible, in-memory implementation of the KV store's API.
A table-driven test consists of three main components:
A type that encapsulates the parameters for running ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.