Go Mock

Open-source Go projects categorized as Mock

Top 23 Go Mock Projects

  • go-sqlmock

    Sql mock driver for golang to test database interactions

    Project mention: How do you unit-test code that reaches out to the db, without introducing interfaces everywhere? | /r/golang | 2023-08-16
  • mockery

    A mock code autogenerator for Go (by vektra)

    Project mention: go-ecommerce-microservices: A practical e-commerce microservices, built with cqrs, event sourcing, vertical slice architecture, event-driven architecture. | /r/golang | 2023-08-26

    Some of the features: - ✅ Using Vertical Slice Architecture as a high level architecture - ✅ Using Event Driven Architecture on top of RabbitMQ Message Broker with a custom [Event Bus](pkg/messaging/bus/) - ✅ Using Event Sourcing in Audit Based services like [Orders Service](services/orders/) - ✅ Using CQRS Pattern and Mediator Patternon top of Go-MediatR library - ✅ Using Dependency Injection and Inversion of Controlon top of uber-go/fx library - ✅ Using RESTFul api with Echo framework and using swagger with swaggo/swag library - ✅ Using Postgres and EventStoreDB to write databases with fully supports transactions(ACID) - ✅ Using MongoDB and Elastic Search for read databases (NOSQL) - ✅ Using OpenTelemetry for collection Distributed Tracing with using Jaeger and Zipkin - ✅ Using OpenTelemetry for collection Metrics with using Prometheus and Grafana - ✅ Using Unit Test for testing small units with mocking dependent classes and using Mockery for mocking dependencies - ✅ Using End2End Test and Integration Test for testing features with all of their real dependeinces using docker containers (cleanup tests) and testcontainers-go library

  • InfluxDB

    Collect and Analyze Billions of Data Points in Real Time. Manage all types of time series data in a single, purpose-built database. Run at any scale in any environment in the cloud, on-premises, or at the edge.

  • hoverfly

    Lightweight service virtualization/ API simulation / API mocking tool for developers and testers

    Project mention: We created WireMock, an API platform that is designed to improve developer productivity and enables developers and testers to Mock APIs in every stage of the API lifecycle | /r/golang | 2023-02-02

    Use https://github.com/SpectoLabs/hoverfly

  • gock

    HTTP traffic mocking and testing made easy in Go ༼ʘ̚ل͜ʘ̚༽

    Project mention: Testing calls to external APIs | /r/golang | 2022-12-09

    Mocking the http client with explicit responses; for example using h2non/gock

  • httpmock

    HTTP mocking for Golang

    Project mention: Golang rest-api testing | /r/golang | 2022-12-27
  • counterfeiter

    A tool for generating self-contained, type-safe test doubles in go

    Project mention: Mocking database calls without a library? | /r/golang | 2023-02-07

    then just replace whole function, don't generate manually the mock '__') or it would get out of hand fast, you can just use codegen that static typed like https://github.com/maxbrunsfeld/counterfeiter

  • service-pattern-go

    Simple clean Go REST API architecture with dependency injection and mocking example, following SOLID principles.

  • Onboard AI

    Learn any GitHub repo in 59 seconds. Onboard AI learns any GitHub repo in minutes and lets you chat with it to locate functionality, understand different parts, and generate new code. Use it for free at www.getonboard.dev.

  • Mmock

    Mmock is an HTTP mocking application for testing and fast prototyping

  • go-txdb

    Immutable transaction isolated sql driver for golang

    Project mention: Integration Tests with Postgres | /r/golang | 2023-03-29

    3 years ago I created a internal library where I worked to setup the testing with the db's. One param was the schema directory and the other one was the path of the data insertion file. It worked really well but was a little slow. It was a little bit weird to configure the container to run the tests. As I would have to give access to go container that ran the unit tests access to docker. But back then I was running boot2docker and made things very cumbersome. I think with a local docker things would be way simpler. I ended up using and normal DB from the CI/CD and https://github.com/DATA-DOG/go-txdb If I had to do it again I might do an hybrid in-between the two solutions

  • gripmock

    gRPC Mock Server

  • minimock

    Powerful mock generation tool for Go programming language

  • killgrave

    Simple way to generate mock servers written in Go

  • openapi-mock

    OpenAPI mock server with random data generation

  • redismock

    Redis client Mock

  • charlatan

    Go Interface Mocking Tool

  • govcr

    HTTP mock for Golang: record and replay HTTP/HTTPS interactions for offline testing

  • gomockhandler

    Mr. gomockhandler is the clever and more agile manager of golang/mock 👔

  • go-smtp-mock

    SMTP mock server written on Golang. Mimic any 📤 SMTP server behavior for your test environment with fake SMTP server.

  • go-github-mock

    A library to aid unittesting code that uses Golang's Github SDK

  • go-localstack

    Go Wrapper for using localstack

  • timex

    A test-friendly replacement for golang's time package (by cabify)

  • gadgeto

    Gadgeto! is a collection of tools that aim to facilitate the development of REST APIs in Go.

    Project mention: Replacement for loopfz/gadgeto (OpenAPI 3 generator) | /r/golang | 2023-12-05

    I've been using wI2L/fizz with loopfz/gadgeto for autogenerating OpenAPI 3 documentation, but both libraries seem to have died down and there are many pull requests that haven't gotten any attention.

  • go-sdk

    Official Keploy Go SDK 🔵 (by keploy)

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

NOTE: The open source projects on this list are ordered by number of github stars. The number of mentions indicates repo mentiontions in the last 12 Months or since we started tracking (Dec 2020). The latest post mention was on 2023-12-05.

Go Mock related posts


What are some of the best open-source Mock projects in Go? This list will help you:

Project Stars
1 go-sqlmock 5,580
2 mockery 5,259
3 hoverfly 2,274
4 gock 1,961
5 httpmock 1,791
6 counterfeiter 889
7 service-pattern-go 759
8 Mmock 651
9 go-txdb 585
10 gripmock 585
11 minimock 520
12 killgrave 455
13 openapi-mock 436
14 redismock 228
15 charlatan 199
16 govcr 161
17 gomockhandler 96
18 go-smtp-mock 93
19 go-github-mock 80
20 go-localstack 73
21 timex 70
22 gadgeto 45
23 go-sdk 39
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives