sábado, 30 de novembro de 2013
Types of test doubles
Types of test doubles[edit]
Gerard Meszaros[1] identified several different terms for what he calls, "Test Doubles." Using his vocabulary, there are at least five types of Test Doubles:
Test stub (used for providing the tested code with "indirect input")
Mock object (used for verifying "indirect output" of the tested code, by first defining the expectations before the tested code is executed)
Test spy (used for verifying "indirect output" of the tested code, by asserting the expectations afterwards, without having defined the expectations before the tested code is executed)
Fake object (used as a simpler implementation, e.g. using an in-memory database in the tests instead of doing real database access)
Dummy object (used when a parameter is needed for the tested method but without actually needing to use the parameter)
While there is no open standard for test double and the various types, there is momentum for continued use of these terms in this manner. Martin Fowler used these terms in his article, Mocks Aren't Stubs[2] referring to Meszaros' book. Microsoft also used the same terms and definitions in an article titled, Exploring The Continuum Of Test Doubles.[3]
Assinar:
Postar comentários (Atom)
Nenhum comentário:
Postar um comentário