What are Test Doubles?

Test Double is a generic term for any case where you replace a production object for testing purposes[1]

What can we do with test doubles?

Types of Test Doubles?

Dummy

  • objects are passed around but never actually used. Usually they are just used to fill parameter lists

Fake

  • objects actually have working implementations, but usually take some shortcut which makes them not suitable for production

Stub

Spies

Mocks

References

  1. Test Doubles: https://martinfowler.com/bliki/TestDouble.html
  2. Effective unit testing