Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 1.52 KB

README.md

File metadata and controls

18 lines (14 loc) · 1.52 KB

TestDoubles

Test doubles are like stunt doubles, they take the place of the 'real' thing in test code. They are particularly useful in TDD but can also help in making existing tests quicker, more reliable and more controllable.

Dummy Object

This is a placeholder object that is passed to the SUT as an argument (or an attribute of an argument) but is never actually used.

Test Stub

This is an object that replaces a real component on which the SUT depends so that the test can control the indirect inputs of the SUT. It allows the test to force the SUT down paths it might not otherwise exercise. Some examples are hard-coded and configurable responders and saboteurs

Test Spy

A Test Spy is a more capable version of a Test Stub. It can be used to verify the indirect outputs of the SUT by giving the test a way to inspect them after exercising the SUT. An example of verifying indirect outputs.

Mock Object

This is an object that replaces a real component on which the SUT depends so that the test can verify its indirect outputs. An example of the mock