Test doubles are categorization many ways.
General Although not universally accepted, Gerard Meszaros categorizes test doubles as: •
Stub — provides static input •
Mock — verifies output via expectations defined before the test runs • Spy — supports setting the output of a call before a test runs and verifying input parameters after the test runs • Fake — a relatively full-function implementation that is better suited to testing than the production version (e.g., an in-memory
database instead of a database
server) • Dummy value — a value that is required for the tested interface but for which the test case does not depend While there is no
open standard for categories,
Martin Fowler used these terms in his article, ''Mocks Aren't Stubs'' referring to Meszaros' book. Microsoft also used the same terms and definitions in an article titled,
Exploring The Continuum Of Test Doubles.
Service For
service-oriented architecture (SOA)
systems and
microservices,
testers use test doubles that communicate with the
system under test over a network protocol. These test doubles are called by different names by the tool vendors. A commonly used term is
service virtualization. Other names used include API simulation, API mock, HTTP stub, HTTP mock, over the wire test double.
Verified fake A
verified fake is a
fake object whose behavior has been verified to match that of the real object using a set of tests that run against both the verified fake and the real implementation. ==See also==