Go Mocking

Open-source Go projects categorized as Mocking

Top 15 Go Mocking Projects

  1. Testify

    A toolkit with common assertions and mocks that plays nicely with the standard library

    Project mention: 5 Golang Libraries You’ll Wish You Knew Sooner | dev.to | 2025-05-18

    Testify simplifies writing unit tests in Go. The standard testing package is fine, but Testify adds assertions, mocking, and suite support, making tests more readable and maintainable.

  2. InfluxDB

    InfluxDB – Built for High-Performance Time Series Workloads. InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.

    InfluxDB logo
  3. mockery

    A mock code autogenerator for Go (by vektra)

  4. hoverfly

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

    Project mention: How to Implement Mock APIs for API Testing | dev.to | 2025-04-07

    Hoverfly: A lightweight service virtualization tool specializing in API simulation and traffic capture for realistic mocks. It's particularly useful for cloud-native applications and supports CI/CD integration.

  5. gock

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

    Project mention: The best way for testing outbound API calls | dev.to | 2025-02-06

    Another great option is gock, a lib that is also inspired by nock, with a simple and easy API. It works by intercepting any HTTP request made by any http.Client and adding it to a list, so it can check if a mock request exists. If not, an error is returned, unless the real networking mode is on. In that case, the request is done normally.

  6. moq

    Interface mocking tool for go generate (by matryer)

  7. apitest

    A simple and extensible behavioural testing library for Go. You can use api test to simplify REST API, HTTP handler and e2e tests.

    Project mention: The best way for testing outbound API calls | dev.to | 2025-02-06

    At last, the apitest is a lib inspired by gock that has an infinity matchers and features. It also allows the user to build a sequence diagram of its HTTP calls. A cool thing is their excellent website with a lot of examples.

  8. vfs for golang

    Virtual filesystem library written in golang

  9. SaaSHub

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

    SaaSHub logo
  10. go-github-mock

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

  11. mocha

    Build Mock APIs in Go (by vitorsalgado)

    Project mention: The best way for testing outbound API calls | dev.to | 2025-02-06

    mocha is a lib inspired by nock and WireMock. It allows checking if the mock was called or not, which is a nice feature. Like httptest, it also it don't automatically intercept the requests.

  12. go-sdk

    Official Keploy Go SDK 🔵 (by keploy)

  13. mockc

    Completely type-safe compile-time mock generator for Go

  14. mockcompose

    mockcompose generates mocking implementation for Go classes, interfaces and functions

  15. mockitout

    A language agnostic HTTP mock server for quick stub testing

  16. mock

    Testify mock without the boilerplate (amd64 + arm64) (by razzie)

    Project mention: Show HN: Testify mock without the boilerplate (Golang) | news.ycombinator.com | 2025-01-01
  17. gokka

    A small Go mocking library powered by Cue

  18. SaaSHub

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

    SaaSHub logo
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).

Go Mocking discussion

Log in or Post with

Go Mocking related posts

  • How to Implement Mock APIs for API Testing

    2 projects | dev.to | 7 Apr 2025
  • The best way for testing outbound API calls

    6 projects | dev.to | 6 Feb 2025
  • Testando chamadas para APIs da melhor forma

    7 projects | dev.to | 6 Feb 2025
  • I Write Tests in Go

    1 project | news.ycombinator.com | 10 Apr 2024
  • Direction of mockery: absorb different styles of mocks into this project · vektra mockery · Discussion #671

    1 project | /r/golang | 11 Jul 2023
  • vektra/mockery has fully released the "packages" feature! This blog explains what it is and how it works.

    1 project | /r/golang | 11 Jul 2023
  • Why elixir over Golang

    10 projects | /r/elixir | 29 May 2023
  • A note from our sponsor - SaaSHub
    www.saashub.com | 18 Jun 2025
    SaaSHub helps you find the best software and product alternatives Learn more →

Index

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

# Project Stars
1 Testify 24,723
2 mockery 6,621
3 hoverfly 2,414
4 gock 2,172
5 moq 2,093
6 apitest 821
7 vfs for golang 475
8 go-github-mock 120
9 mocha 49
10 go-sdk 45
11 mockc 33
12 mockcompose 16
13 mockitout 11
14 mock 10
15 gokka 3

Sponsored
InfluxDB – Built for High-Performance Time Series Workloads
InfluxDB 3 OSS is now GA. Transform, enrich, and act on time series data directly in the database. Automate critical tasks and eliminate the need to move data externally. Download now.
www.influxdata.com

Did you know that Go is
the 4th most popular programming language
based on number of references?