intlr / test-double-go

Test Double with Go, concept by Gerard Meszaros

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

Test Double with Go, concept by Gerard Meszaros

License:MIT License


Languages

Language:Go 100.0%