collaborator
Another object or service that the code under test calls to get its work done, such as a payment gateway or a clock.
In more detail
Collaborators are what test doubles replace. Keep the interface to each one small, defined by what your code needs, so doubles stay cheap and honest.
Related terms
- test double — Any object that replaces a real dependency in a test: a stub returns canned data, a fake is a small working implementation, and a mock checks interactions.
- seam — A place in the code where you can swap in different behaviour without editing the code itself, such as a parameter.
- dependency — Anything a program needs in order to work, such as a library, a tool or another service.
Taught in
- What Test Doubles Are For — Automated Testing, TDD & Quality Engineering
- Fakes, Stubs, Mocks And Spies — Automated Testing, TDD & Quality Engineering
- Why Over-Mocking Breeds False Positives — Automated Testing, TDD & Quality Engineering