Comparison
SeamvsTest double
Seam
you needed to test the payment path and there was nowhere to slip a fake in without editing the code you were testing.
A place where you can change behaviour without editing the code at that place — a parameter, an interface, a configuration point. Seams are what make legacy code testable, because they are where a real dependency can be replaced with a fake. Finding or creating a seam is usually the first move when changing code nobody dares touch, and the absence of seams is exactly what makes such code frightening.
Full entry →Test double
you swap the real collaborator for a stand-in, because the real one is slow, remote, or has side effects you cannot have in a test.
The umbrella term for any object substituted for a real dependency in a test: stubs, mocks, fakes and spies are all test doubles. Naming the specific kind matters because they answer different questions — some make a test possible, others make an assertion. Calling everything a mock is why test reviews go in circles.
Full entry →