How do you write/generate mocks for testing?

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

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
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  1. mockery

    A mock code autogenerator for Go (by vektra)

    My bread and butter is mockery (https://github.com/vektra/mockery). It has a few shortcomings (a config would be really nice in my project) which should be fixed in v3 (https://github.com/vektra/mockery#v3).

  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. moq

    Interface mocking tool for go generate (by matryer)

    Currently trying out https://github.com/matryer/moq for the first time, and quite positive so far. Haven't pushed it enough yet to give a real opinion.

  4. gomock

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

    Currently migrating from moq to https://github.com/golang/mock

  5. minimock

    Powerful mock generation tool for Go programming language

  6. 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.

  7. SaaSHub

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

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

  • 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
  • Go: Write Mock Test cases using Mockery and

    1 project | dev.to | 10 May 2023
  • Mocking unexported interfaces?

    1 project | /r/golang | 28 Apr 2023
  • vektra/mockery: v2.21.0 includes "packages" config section, allowing 5x faster mock generation and more fine-grained control over mocks

    1 project | /r/golang | 4 Mar 2023