vektra/mockery

A mock code autogenerator for Go

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 53 minutes ago
Added to GitGenius on September 9th, 2026
Created on September 2nd, 2014
Open Issues & Pull Requests: 49 (+0)
GitHub issues: Enabled
Number of forks: 459
Total Stargazers: 7,158 (-1)
Total Subscribers: 29 (+0)

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Issue API getrepoissuespagesummary failed: 429 Rate limit exceeded. Please try again later.

Detailed Description

Mockery is a mock code autogenerator for Go that produces mocks compatible with the stretchr/testify/mock package. It eliminates the need to write boilerplate mock implementations by automatically generating them from interface definitions, allowing developers to focus on test logic rather than mock setup.

The tool solves the problem of tedious manual mock creation in Go testing. When writing unit tests, developers must create mock implementations of interfaces to isolate code under test. Mockery automates this by analyzing Go interface definitions and generating corresponding mock structs that integrate with testify/mock, handling method signatures, return types, and assertion capabilities automatically.

Mockery suits any Go project that uses interface-based design and testify for testing. It is particularly valuable in larger codebases where many interfaces need mocking, as it reduces maintenance burden when interfaces change. The tool is appropriate for teams already committed to the testify ecosystem, since it generates mocks specifically designed to work with testify/mock's assertion and expectation-setting APIs.

The project maintains active development with regular updates and bug fixes. The maintainers use taskfile.dev for build automation and have established clear development workflows documented in the Taskfile. The project includes comprehensive test coverage and maintains a public documentation site separate from the repository, indicating sustained investment in user experience and onboarding.