mockeryby vektra
Tool to generate Go interfaces.
github.com/vektra/mockery/v3Go 1.26+ 20 dependenciesv3.9.0updated today
23 projects
Mocking in Go is built around interfaces: you depend on a small interface, then substitute a fake in tests. Mock libraries generate those fakes or provide ready-made ones for common dependencies such as databases and HTTP services. They split into code generators for your own interfaces, mocks for specific drivers and protocols, and record-and-replay tools that capture real traffic.
mockeryby vektra
Tool to generate Go interfaces.
github.com/vektra/mockery/v3Go 1.26+ 20 dependenciesv3.9.0updated today
go-sqlmockby DATA-DOG
Mock SQL driver for testing database interactions.
github.com/DATA-DOG/go-sqlmockGo 1.15+ 1 dependencyv1.5.2updated 3mo ago
gomockby uber-go
Mocking framework for the Go programming language.
go.uber.org/mockGo 1.25+ 3 dependenciesv0.6.0updated 2mo ago
hoverflyby SpectoLabs
HTTP(S) proxy for recording and simulating REST/SOAP APIs with extensible middleware and easy-to-use CLI.
github.com/SpectoLabs/hoverflyGo 1.27+ 41 dependenciesv1.12.17updated 1d ago
moqby matryer
Utility that generates a struct from any interface. The struct can be used in test code as a mock of the interface.
github.com/matryer/moqGo 1.26+ 2 dependenciesv0.8.1updated 19d ago
httpmockby jarcoal
Easy mocking of HTTP responses from external resources.
github.com/jarcoal/httpmockGo 1.18+ 1 dependencyv1.4.2updated 27d ago
counterfeiterby maxbrunsfeld
Tool for generating self-contained mock objects.
github.com/maxbrunsfeld/counterfeiter/v6Go 1.26+ 5 dependenciesv6.14.0updated 19d ago
minimockby gojuno
Mock generator for Go interfaces.
github.com/gojuno/minimock/v3Go 1.23+ 9 dependenciesv3.4.7updated 13d ago
go-txdbby DATA-DOG
Single transaction based database driver mainly for testing purposes.
github.com/DATA-DOG/go-txdbGo 1.21+ No dependencies v0.2.1updated 1y ago
pgxmockby pashagolub
A mock library implementing pgx - PostgreSQL Driver and Toolkit.
github.com/pashagolub/pgxmock/v6Go 1.25+ 2 dependenciesv5.2.0updated 28d ago
xgoby xhd2015
A general pureposed function mocking library.
github.com/xhd2015/xgoGo 1.18+ No dependencies v1.2.9updated 2mo ago
govcrby seborama
HTTP mock for Golang: record and replay HTTP interactions for offline testing.
github.com/seborama/govcr/v17Go 1.25+ 10 dependenciesv17.1.0updated 6mo ago
go-localstackby elgohr
Tool for using localstack in AWS testing.
github.com/elgohr/go-localstackGo 1.25+ 33 dependenciesupdated 22d ago
timexby cabify
A test-friendly replacement for the native time package.
github.com/cabify/timexGo 1.13+ 1 dependencyv1.1.0updated 6y ago
fabricatorby Goldziher
Type-safe factories for generating mock and fake data in Go, inspired by factory_boy and interface-forge.
github.com/Goldziher/fabricator/v2Go 1.26+ 2 dependenciesv2.1.0updated 1d ago
mooncakeby GuilhermeCaruso
A simple way to generate mocks for multiple purposes.
github.com/GuilhermeCaruso/mooncakeGo 1.18+ 2 dependenciesv0.0.2updated 4y ago
mockfsby balinomad
Mock filesystem for Go testing with error injection and latency simulation, built on testing/fstest.MapFS.
github.com/balinomad/go-mockfs/v2Go 1.25+ No dependencies v2.0.0updated 1mo ago
gomockby vibridi
CLI tool to generate typed and framework-agnostic interface mocks, with support for generics.
github.com/vibridi/gomock/v3Go 1.26+ 2 dependenciesv3.7.1updated 6mo ago
gomockerby zhongjie-cai
A live mocker library for functions and methods in Golang for unit testing with fluent syntax, no code-gen needed.
github.com/zhongjie-cai/gomocker/v2Go 1.25+ 1 dependencyv2.1.3updated 5d ago
wsmockby sing198
Expressive, zero-boilerplate WebSocket mock server for testing with fault injection and assertions.
github.com/sing198/wsmockGo 1.22+ 1 dependencyupdated 2mo ago