Go Mock

Open-source Go projects categorized as Mock | Edit details

Top 21 Go Mock Projects

  • GitHub repo gomock

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

    Project mention: Mocking with High-Order Functions in Go | reddit.com/r/golang | 2021-08-06

    Honestly curious - why wouldn't you use something like https://github.com/golang/mock to generate your mocks from an interface. Way more productive, consistent and cleaner. Spend more time and focus on your business logic rather than something that's already been solved.

  • GitHub repo go-sqlmock

    Sql mock driver for golang to test database interactions

    Project mention: Go Package for better integration tests: github.com/ory/dockertest | dev.to | 2021-04-23

    We have different ways to write our tests depending on what datastore we are using, for example if we are testing database calls that happen to be using database/sql then importing a package like github.com/DATA-DOG/go-sqlmock could work.

  • Nanos

    Run Linux Software Faster and Safer than Linux with Unikernels.

  • GitHub repo mockery

    A mock code autogenerator for Golang (by vektra)

    Project mention: mockcompose to generate mocking implementation for Go classes, interfaces and functions | reddit.com/r/golang | 2021-07-06

    As a Go newbie, the on-boarding process to Golang went relatively smoothly except a small glitch when it came to search for a mocking framework to test out a Go class implementation. I was a bit surprised to realize that I was not able to find a on-shelf tool to help me mock a class method. It might be an edge case scenario that I wanted to mock a class method, but I do believe that this is a valid use case, so I went ahead to spend a weekend building such a tool: mockcompose. It was originally aimed to just solve this one particular use case, therefore, it had to be used together with mockery (one of the great tools I found during my search in the period). I later refined the tool to cover mocking code generation for Go interfaces and functions, mockcompose can now be used in most of Go unit test scenarios. Please check it out and give it a try, I hope the tool is useful, feel free to drop your feedback and share with your opinion there.

  • GitHub repo hoverfly

    Lightweight service virtualization/API simulation tool for developers and testers

  • GitHub repo gock

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

    Project mention: Go Package for Mocking HTTP Traffic: github.com/h2non/gock | dev.to | 2021-04-16

    Last time I covered testing in Go I mentioned a package used for testing equality called github.com/google/go-cmp, this time I will share with you a way to mock HTTP traffic using the package github.com/h2non/gock.

  • GitHub repo httpmock

    HTTP mocking for Golang

    Project mention: Best practices around mocking interfaces from external packages | reddit.com/r/golang | 2021-05-06

    Alternatively, you could use an http mock library like https://github.com/jarcoal/httpmock, and override the urls the RealClient calls with a mock response in your tests.

  • GitHub repo counterfeiter

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

    Project mention: Slack notification Github action | reddit.com/r/golang | 2021-08-06
  • Scout APM

    Scout APM: A developer's best friend. Try free for 14-days. Scout APM uses tracing logic that ties bottlenecks to source code so you know the exact line of code causing performance issues and can get back to building a great product faster.

  • GitHub repo Mmock

    Mmock is an HTTP mocking application for testing and fast prototyping

  • GitHub repo minimock

    Powerful mock generation tool for Go programming language

  • GitHub repo go-txdb

    Immutable transaction isolated sql driver for golang

  • GitHub repo killgrave

    Simple way to generate mock servers written in Go

    Project mention: How to integrate an external API into your PHP application🔥 | dev.to | 2021-08-10

    I have used Killgrave and the result was really good. The best of all is that you can configure a mock API just using yml configurations files.

  • GitHub repo govcr

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

  • GitHub repo timex

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

  • GitHub repo gomockhandler

    Mr. gomockhandler is the clever and fast manager of golang/mock.

    Project mention: more clever and faster management for gomock (sanposhiho/gomockhandler) | reddit.com/r/golang | 2021-08-19
  • GitHub repo mockhttp

    Mock object for Go http.ResponseWriter

  • GitHub repo go-localstack

    Go Wrapper for using localstack

  • GitHub repo flute

    Golang HTTP client testing framework

  • GitHub repo mockitout

    A language agnostic HTTP mock server for quick stub testing

  • GitHub repo mockit

    Library that make mocking of Go functions/methods easy (by pasdam)

    Project mention: Unit Testing in Golang | reddit.com/r/golang | 2021-02-01

    A different approach to mocking in Go https://github.com/pasdam/mockit that is more similar to JavaScript and Mockito (Java).

  • GitHub repo mockcompose

    mockcompose generates mocking implementation for Go classes, interfaces and functions

    Project mention: mockcompose to generate mocking implementation for Go classes, interfaces and functions | reddit.com/r/golang | 2021-07-06

    Part of reason that I went ahead to build mockcompose was for to improve test coverage of an existing project without major refactoring. Another reason is for completeness of a mocking tool to cover all possible aspects in unit-test scenarios that Go technically allows. It was meant to use it with Go best practices in mind.

  • GitHub repo webmock

    Webmock for Golang, to stub requests. (by hlcfan)

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 2021-08-19.


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

Project Stars
1 gomock 6,193
2 go-sqlmock 3,798
3 mockery 2,912
4 hoverfly 1,773
5 gock 1,488
6 httpmock 1,179
7 counterfeiter 571
8 Mmock 565
9 minimock 414
10 go-txdb 385
11 killgrave 228
12 govcr 98
13 timex 55
14 gomockhandler 34
15 mockhttp 22
16 go-localstack 16
17 flute 16
18 mockitout 9
19 mockit 9
20 mockcompose 5
21 webmock 1
Find remote jobs at our new job board 99remotejobs.com. There are 25 new remote jobs listed recently.
Are you hiring? Post a new remote job listing for free.
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives