counterfeiter
« Back to VersTracker
Description:
Tool for generating self-contained, type-safe test doubles in go
Type: Formula  |  Latest Version: 6.12.1@0  |  Tracked Since: Dec 17, 2025
Links: Homepage  |  formulae.brew.sh
Category: Developer tools
Tags: testing mocking golang code-generation tdd
Install: brew install counterfeiter
About:
Counterfeiter is a code generation tool for the Go programming language that creates test doubles, also known as fakes or mocks. It generates fully self-contained, type-safe implementations of interfaces based on simple annotations. This allows developers to write reliable unit tests by easily isolating dependencies and verifying interactions.
Key Features:
  • Generates type-safe, self-contained fakes from Go interfaces
  • Simple annotation-based code generation
  • Supports both fakes and mocks for behavior verification
  • Integrates seamlessly with the standard Go testing framework
Use Cases:
  • Isolating external dependencies in unit tests
  • Verifying interactions and call sequences on interfaces
  • Testing complex business logic without setting up real services
Alternatives:
  • gomock – Part of the official Go toolchain but has been deprecated; Counterfeiter offers a simpler annotation-based approach.
  • testify/mock – Provides manual mock implementations; Counterfeiter automates the generation, reducing boilerplate code.
License: MIT
Dependencies: go
Bottles available for: arm64_tahoe, arm64_sequoia, arm64_sonoma, sonoma, arm64_linux, x86_64_linux
Version History
Detected Version Rev Change Commit
Sep 14, 2025 2:17am 0 VERSION_BUMP 2bb60c36
Dec 18, 2024 4:56pm 0 VERSION_BUMP c52080ee