Cheat Sheet Unit Testing 1635173296
Cheat Sheet Unit Testing 1635173296
Fake 1
Object with working implementation - different from
production one. Simplify external dependency setup
complexity.
Stub
Object that holds predefined data used to answer calls
during tests. Provides indirect input to the unit from a low-level, focusing on a small
dependency. part of the software system
Mock 2
Allows mocks to verify method invocation of the unit - for
example service method invoking the repository method.
Spy
Spies use the original implementation. It is a wrapper of
the original, so it records the number of calls, not the input.
usually written by programers
themselves using their regular tools
Do Don’ts
expected to be significantly
faster than other kinds of tests
www.askui.com