GoMock is a mocking framework for the Go programming language.
Features
Go Mocking Libraries - Generates mock implementations from Go interfaces for use in unit tests.
Stub and Record Patterns - Allows defining return values for methods while also recording actual call arguments for later assertion.
Mock Argument Matchers - Provides a set of matchers that compare actual arguments against expected values or patterns.
Mock Implementations - Generates mock implementations by scanning compiled Go packages or source files to discover interface definitions.
Interaction Expectations - Matches actual method calls against predefined expectations using argument matchers and call counters.
Mock Call Order Verifications - Tracks the sequence of mock method invocations to verify they occur in the expected order.
Behavior Verification - Verifies that mocked methods are called with expected arguments and in the correct order during test execution.
Mock Behavior Configuration - Configures mock methods to execute custom logic or return fixed values without checking call expectations.
Mocking Frameworks - Generates and manages mock implementations of Go interfaces for unit testing with configurable call expectations and stub behavior.
Package-Based Generators - Generates mock implementations by scanning compiled Go packages to discover interface definitions.
Interface-Based Test Doubles - Tests Go code by replacing real dependencies with mock objects that implement the same interfaces.
Source File Generators - Generates mock implementations by reading interface definitions directly from a Go source file.
Mock Expectation Verifiers - Verifies that mocked methods receive expected arguments and return configured values during test execution.
Test Double Libraries - Provides test doubles for Go interfaces with support for call expectations, argument matching, and return value configuration.