A mock code autogenerator for Go
Alternatives To Mockery
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Testify20,66514,68870,4263 days ago42May 30, 2023427mitGo
A toolkit with common assertions and mocks that plays nicely with the standard library
Mockito14,22338,95013,12010 hours ago343June 18, 2023358mitJava
Most popular Mocking framework for unit tests written in Java
Msw13,2301,723a day ago176July 20, 202399mitTypeScript
Seamless REST/GraphQL API mocking library for browser and Node.js.
Mockery10,466112,37918,26124 days ago40July 19, 2023106bsd-3-clausePHP
Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL).
Mock9,0574,5339,4242 months ago55May 12, 202285apache-2.0Go
GoMock is a mocking framework for the Go programming language.
Go Sqlmock5,4251,336a month ago21June 28, 202075otherGo
Sql mock driver for golang to test database interactions
Mockoon5,39466 hours ago45July 24, 202371otherTypeScript
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
5 days ago254apache-2.0Kotlin
mocking library for Kotlin
Mockery5,0512773 days ago134August 04, 202337bsd-3-clauseGo
A mock code autogenerator for Go
1,2384 months ago60December 02, 202053mitObjective-C
Stub your network requests easily! Test your apps with fake network data and custom response time, response code and headers!
Alternatives To Mockery
Select To Compare

Alternative Project Comparisons


Release reference GitHub go.mod Go version GitHub release (latest SemVer) Go Report Card codecov

mockery provides the ability to easily generate mocks for Golang interfaces using the stretchr/testify/mock package. It removes the boilerplate coding required to use mocks.


Documentation is found at out GitHub Pages site.

Development is used for build tasks. Initialize all go build tools:

go mod download -x

You can run any of the steps listed in Taskfile.yml:

$ task test
task: [test] go test -v -coverprofile=coverage.txt ./...

Development Efforts


v1 is the original version of the software, and is no longer supported.


mockery is currently in v2, which originally included cosmetic and configuration improvements over v1, but also implements a number of quality-of-life additions.


v3 will include a ground-up overhaul of the entire codebase and will completely change how mockery works internally and externally. The highlights of the project are:

  • Moving towards a package-based model instead of a file-based model. mockery currently iterates over every file in a project and calls package.Load on each one, which is time-consuming. Moving towards a model where the entire package is loaded at once will dramatically reduce runtime, and will simplify logic. Additionally, supporting only a single mode of operation (package mode) will greatly increase the intuitiveness of the software.
  • Configuration-driven generation. v3 will be entirely driven by configuration, meaning:
    • You specify the packages you want mocked, instead of relying on it auto-discovering your package. Auto-discovery in theory sounds great, but in practice it leads to a great amount of complexity for very little benefit.
    • Package- or interface-specific overrides can be given that change mock generation settings on a granular level. This will allow your mocks to be generated in a heterogeneous manner, and will be made explicit by YAML configuration.
  • Proper error reporting. Errors across the board will be done in accordance with modern Golang practices
  • Variables in generated mocks will be given meaningful names.


Stargazers over time

Popular Mocking Projects
Popular Mock Projects
Popular Software Quality Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.