Test Doubles Defined
Learn about test doubles and their disadvantages.
We'll cover the following...
One complicating factor in dealing with test doubles is that pretty much everybody who creates a tool feels perfectly free to use slightly different naming conventions than everybody else. Here are the names, which are of course also the correct ones. This naming structure is the creation of Gerard Meszaros.
Mock objects as a term
The generic term for any object used as a stand-in for another object is test double, by analogy to “stunt double” and with the same connotation of a cheaper or more specialized replacement for a more expensive real object. Colloquially, mock object is also sometimes used as a generic term but, confusingly, is also the name of a specific type of test double.
Fake objects
A fake object is typically an ordinary Ruby object that we define designed to be used only in tests. The fake object matches the API of an object but has vastly simplified or canned internals. Fakes are not typically created using a ...