Mocking is a process used in unit testing when the unit being tested has external dependencies. The purpose of mocking is to isolate and focus on the code being tested and not on the behavior or state of external dependencies. A mocking framework is a library that provides the ability to replace some components in your system with mock objects and make assertions about how they have been used. Go comes with built-in support for mocking: if you embed an interface in your struct, you can override it at will in your tests. Some great Go mocking libraries are testify - common assertions and mocks that plays nicely; go-sqlmock - Sql mock driver for golang to test database interactions; mockery - A mock code autogenerator for Golang.
testifyby stretchr
A toolkit with common assertions and mocks that plays nicely with the standard library
testifyby stretchr
Go 19888 Version:v1.8.4 License: Permissive (MIT)
go-sqlmockby DATA-DOG
Sql mock driver for golang to test database interactions
go-sqlmockby DATA-DOG
Go 5282 Version:v1.5.0 License: Others (Non-SPDX)
gockby h2non
HTTP traffic mocking and testing made easy in Go ༼ʘ̚ل͜ʘ̚༽
gockby h2non
Go 1873 Version:v1.2.0 License: Permissive (MIT)
httpliveby gencebay
HTTP Request & Response Service, Mock HTTP
httpliveby gencebay
Go 1123 Version:20201202124733-201502a License: Permissive (MIT)
stripe-mockby stripe
stripe-mock is a mock HTTP server that responds like the real Stripe API. It can be used instead of Stripe's testmode to make test suites integrating with Stripe faster and less brittle.
stripe-mockby stripe
Go 1190 Version:v0.164.0 License: Permissive (MIT)
gnomockby orlangure
Test your code without writing mocks with ephemeral Docker containers 📦 Setup popular services with just a couple lines of code ⏱️ No bash, no yaml, only code 💻
gnomockby orlangure
Go 1188 Version:v0.28.0 License: Permissive (MIT)
mmockby jmartin82
Mmock is an HTTP mocking application for testing and fast prototyping
mmockby jmartin82
Go 641 Version:v3.1.6 License: Permissive (MIT)
apisproutby danielgtaylor
Lightweight, blazing fast, cross-platform OpenAPI 3 mock server with validation
apisproutby danielgtaylor
Go 627 Version:v1.3.0 License: Permissive (MIT)
killgraveby friendsofgo
Simple way to generate mock servers written in Go
killgraveby friendsofgo
Go 388 Version:v0.4.1 License: Permissive (MIT)
openapi-mockby muonsoft
OpenAPI mock server with random data generation
openapi-mockby muonsoft
Go 367 Version:v0.3.9 License: Permissive (MIT)
mock-databy faisaltheparttimecoder
Mock data in PostgreSQL/Greenplum databases
mock-databy faisaltheparttimecoder
Go 107 Version:v3.0 License: Permissive (MIT)