# golang/mock

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/golang-mock).**

9,361 stars · 604 forks · Go · Apache-2.0 · archived

## Links

- GitHub: https://github.com/golang/mock
- awesome-repositories: https://awesome-repositories.com/repository/golang-mock.md

## Description

GoMock is a mocking framework for the Go programming language.

## Tags

### Programming Languages & Runtimes

- [Go Mocking Libraries](https://awesome-repositories.com/f/programming-languages-runtimes/go-mocking-libraries.md) — Generates mock implementations from Go interfaces for use in unit tests.
- [Stub and Record Patterns](https://awesome-repositories.com/f/programming-languages-runtimes/block-value-returns/method-return-values/fluent-method-chain-stubs/stub-and-record-patterns.md) — Allows defining return values for methods while also recording actual call arguments for later assertion.
- [Mock Argument Matchers](https://awesome-repositories.com/f/programming-languages-runtimes/programming-utilities/function-utilities/argument-collectors/splat-argument-validations/argument-constraint-matchers/mock-argument-matchers.md) — Provides a set of matchers that compare actual arguments against expected values or patterns.

### Software Engineering & Architecture

- [Mock Implementations](https://awesome-repositories.com/f/software-engineering-architecture/compile-time-code-generation/interface-code-generators/mock-implementations.md) — Generates mock implementations by scanning compiled Go packages or source files to discover interface definitions.

### Testing & Quality Assurance

- [Interaction Expectations](https://awesome-repositories.com/f/testing-quality-assurance/api-expectation-frameworks/interaction-expectations.md) — Matches actual method calls against predefined expectations using argument matchers and call counters.
- [Mock Call Order Verifications](https://awesome-repositories.com/f/testing-quality-assurance/api-expectation-frameworks/interaction-expectations/ordered/mock-call-order-verifications.md) — Tracks the sequence of mock method invocations to verify they occur in the expected order.
- [Behavior Verification](https://awesome-repositories.com/f/testing-quality-assurance/behavior-verification.md) — Verifies that mocked methods are called with expected arguments and in the correct order during test execution.
- [Mock Behavior Configuration](https://awesome-repositories.com/f/testing-quality-assurance/mock-behavior-configuration.md) — Configures mock methods to execute custom logic or return fixed values without checking call expectations. ([source](https://cdn.jsdelivr.net/gh/golang/mock@main/README.md))
- [Mocking Frameworks](https://awesome-repositories.com/f/testing-quality-assurance/mocking-frameworks.md) — Generates and manages mock implementations of Go interfaces for unit testing with configurable call expectations and stub behavior.
- [Package-Based Generators](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/dependency-mocking/automated-mock-generation/compile-time-mock-generation/package-based-generators.md) — Generates mock implementations by scanning compiled Go packages to discover interface definitions. ([source](https://cdn.jsdelivr.net/gh/golang/mock@main/README.md))
- [Interface-Based Test Doubles](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/dependency-mocking/automated-mock-generation/dynamic-mock-objects/multi-interface-mocks/interface-based-test-doubles.md) — Tests Go code by replacing real dependencies with mock objects that implement the same interfaces.
- [Source File Generators](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/dependency-mocking/automated-mock-generation/source-file-generators.md) — Generates mock implementations by reading interface definitions directly from a Go source file. ([source](https://cdn.jsdelivr.net/gh/golang/mock@main/README.md))
- [Mock Expectation Verifiers](https://awesome-repositories.com/f/testing-quality-assurance/software-testing/testing-frameworks/test-frameworks/assertions-and-validation/assertion-validation-utilities/expectation-presence-validation/mock-expectation-verifiers.md) — Verifies that mocked methods receive expected arguments and return configured values during test execution. ([source](https://cdn.jsdelivr.net/gh/golang/mock@main/README.md))
- [Test Double Libraries](https://awesome-repositories.com/f/testing-quality-assurance/test-double-libraries.md) — Provides test doubles for Go interfaces with support for call expectations, argument matching, and return value configuration.

### Part of an Awesome List

- [Testing and QA](https://awesome-repositories.com/f/awesome-lists/devtools/testing-and-qa.md) — Mocking framework for Go.
- [Testing and Quality Assurance](https://awesome-repositories.com/f/awesome-lists/devtools/testing-and-quality-assurance.md) — Mocking framework for Go.
- [Testing Frameworks](https://awesome-repositories.com/f/awesome-lists/devtools/testing-frameworks.md) — Official mocking framework.
