Skip to content

Test Double with Go, concept by Gerard Meszaros

License

Notifications You must be signed in to change notification settings

intlr/test-double-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test Double

GoDoc Go Report Card

Gerard Meszaros introduced the differences between test objects in his xUnit Test Patterns book published in May 2007.

The generic term he used to define a simplified version of an object or procedure to reduce complexity and ease testing is Test Double.

From this generic terms come several more precise terms.

The SUT (System Under Test) is a service on which we inject doubles to test interactions with its datastore.

Dummy

Dummys are being passed around without being used.

Fake

Fakes have simplified implementations.

Stub

Stubs are limited to what is defined for the test, they don't have expectations.

Spy

Spies are stubs recording usage. Expectations are evaluated after the execution of the test.

Mock

Mocks define expectations before the test is executed, throwing errors if an unexpected call was made.