seam
A place in the code where you can swap in different behaviour without editing the code itself, such as a parameter.
In more detail
The simplest seam is passing a collaborator in as an argument instead of building it inside. Michael Feathers named the idea in Working Effectively with Legacy Code. A clock or generator argument with a default is often the smallest useful seam.
Related terms
- dependency injection — Giving an object the collaborators it needs from outside, usually through its constructor, instead of letting it create or look them up itself.
- 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.
- default argument — A value a function uses for a parameter when the caller leaves that parameter out.
Taught in
- What Test Doubles Are For — Automated Testing, TDD & Quality Engineering
- Why Over-Mocking Breeds False Positives — Automated Testing, TDD & Quality Engineering
- Testing Time And Randomness — Automated Testing, TDD & Quality Engineering
- Testing The Filesystem — Automated Testing, TDD & Quality Engineering
- Flaky Tests And How To Kill Them — Automated Testing, TDD & Quality Engineering