The document discusses test doubles, which are objects used in place of real collaborators during unit testing. It describes different types of test doubles like dummies, stubs, fakes, spies and mocks, explaining their behaviors and purposes. Key principles for designing test doubles are also outlined, such as keeping their interfaces simple and avoiding side effects.
8. A unit of
software
Can be a query: returns a response
Can be a command: produces a change
in the state of the system
You should test the results of the behavior
9. When you test it You want to prove that the behavior:
• Is produced by the code of the unit of
software
• Is not influenced by any other factor
10. So, you need to
control the
behavior of
collaborators
Cancelling: no behavior at all
Controlling: knowing exactly what they
are doing (by means of programming it)