How do you write/generate mocks for testing?

This page summarizes the projects mentioned and recommended in the original post on

Our great sponsors
  • InfluxDB - Access the most powerful time series database as a service
  • SonarQube - Static code analysis for 29 languages.
  • SaaSHub - Software Alternatives and Reviews
  • mockery

    A mock code autogenerator for Golang (by vektra)

    My bread and butter is mockery ( It has a few shortcomings (a config would be really nice in my project) which should be fixed in v3 (

  • moq

    Interface mocking tool for go generate

    Currently trying out for the first time, and quite positive so far. Haven't pushed it enough yet to give a real opinion.

  • InfluxDB

    Access the most powerful time series database as a service. Ingest, store, & analyze all types of time series data in a fully-managed, purpose-built database. Keep data forever with low-cost storage and superior data compression.

  • gomock

    GoMock is a mocking framework for the Go programming language. (by golang)

    Currently migrating from moq to

  • minimock

    Powerful mock generation tool for Go programming language

  • counterfeiter

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

    counterfeiter is another tool, it creates mocks, stubs and spies; here is a short blog I wrote covering it.

  • SonarQube

    Static code analysis for 29 languages.. Your projects are multi-language. So is SonarQube analysis. Find Bugs, Vulnerabilities, Security Hotspots, and Code Smells so you can release quality code every time. Get started analyzing your projects today for free.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts