test double in go.

Go Test Doubles by Example

Introduction When writing tests for a program, we often need to consider dependencies and external APIs that we prefer not to call every time the test runs. Calling these external dependencies not only adds complexity to our tests but also incurs costs. To address this issue, we can use test doubles. What Are Test Doubles? Test doubles offer an alternative to real dependencies. While we commonly refer to all of them as mocks, there are various test doubles, each serving different purposes....

December 31, 2023 · 7 min · Amin Rashidbeigi