grpcmock-go

What grpcmock-go is
grpcmock-go is a free, MIT-licensed Go module for testing gRPC clients and servers. It provides mock-server utilities with expectations for methods, headers, and payloads, along with helpers to invoke gRPC methods from tests. Supported call types include unary, client-streaming, server-streaming, and bidirectional-streaming methods. Request matching can use exact values, regular expressions, JSON, or custom matchers. Mocks can return payloads or errors, or call custom handlers; streaming client invocations can also use custom handlers. Services can be registered using generated Go code, service instances, or individual methods without generated code. The project recommends MockServerWithBufConn for testing an application against a mocked server, and its examples use in-memory bufconn listeners and context dialers. Installation uses `go get go.nhat.io/grpcmock`. The listed prerequisite is Go 1.25 or later. The module is published under the nhatthm GitHub account, and its listed Open-source Go module plan costs nothing.
Who it suits
grpcmock-go suits Go developers who need to exercise gRPC clients, servers, and streaming methods in tests. It is intended for self-hosted use and requires Go 1.25 or later.
What it does well
- Mocks gRPC servers and invokes methods from tests.
- Supports unary and three streaming call types.
- Offers exact, regex, JSON, and custom matchers.
- Can register services without generated Go code.
- Free under the MIT License.
What to know first
- Requires Go 1.25 or later.
- Focused on Go gRPC testing utilities.
- The README invites users to fund development with a coffee donation.
Plans
| Plan | Billed and limits | Price |
|---|---|---|
| Open-source Go module | gRPC testing utilities for Go | Free |
As github.com lists them, read 5 Oct 2026. The maker's own page has the final word.
Getting started
- Install Go 1.25 or later.
- Run `go get go.nhat.io/grpcmock`.
- Use the package in Go tests to invoke gRPC methods or configure mock servers.
- For in-memory application tests, use MockServerWithBufConn with a bufconn listener and context dialer.
Verdict
grpcmock-go offers a range of server-mocking and client-invocation utilities for gRPC tests, including streaming cases. Check the Go version prerequisite before installing it.
Questions
How much does grpcmock-go cost?
The Open-source Go module plan is free.
What does grpcmock-go do?
It provides Go utilities for mocking gRPC servers and invoking gRPC methods from tests.
Which gRPC method types does it support?
Unary, client-streaming, server-streaming, and bidirectional-streaming methods.
What do I need to install it?
Go 1.25 or later is required. The installation command is `go get go.nhat.io/grpcmock`.
What license does it use?
The repository identifies its license as MIT.
Who publishes grpcmock-go?
It is published under the GitHub account nhatthm.
Facts from grpcmock-go's own pages
- Client calls
- It provides helpers to invoke gRPC methods from tests. · github.com, 5 Oct 2026
- Custom handlers
- Streaming client invocations can use custom handlers. · github.com, 5 Oct 2026
- Donation
- The README invites users to buy the maintainer a coffee if the project saved development time. · github.com, 5 Oct 2026
- Funding
- The README invites users who saved development time to buy the maker a cup of coffee. · github.com, 4 Oct 2026
- In-memory connections
- Examples use gRPC bufconn listeners and context dialers for test connections. · github.com, 5 Oct 2026
- In-memory testing
- The server guide recommends MockServerWithBufConn for testing an application with a mocked gRPC server. · github.com, 4 Oct 2026
- Install
- The README gives `go get go.nhat.io/grpcmock` as the installation command. · github.com, 5 Oct 2026
- Installation
- The README gives `go get go.nhat.io/grpcmock` as the installation command. · github.com, 4 Oct 2026
- License
- The repository identifies its license as MIT. · github.com, 5 Oct 2026
- Maintainer
- The repository is published under the GitHub account nhatthm. · github.com, 5 Oct 2026
- Mock responses
- The server guide says mocks can return errors, payloads, or use custom handlers. · github.com, 4 Oct 2026
- Prerequisite
- The README lists Go 1.25 or later as a prerequisite. · github.com, 4 Oct 2026
- Purpose
- grpcmock is a set of gRPC test utilities for Golang. · github.com, 5 Oct 2026
- Release
- GitHub lists v0.34.0, released December 12, 2025, as the latest release. · github.com, 5 Oct 2026
- Request matching
- The server guide documents exact, regular-expression, JSON, and custom matchers for matching values. · github.com, 4 Oct 2026
- Requirement
- The repository README lists Go 1.25 or later as a prerequisite. · github.com, 5 Oct 2026
- Server and client testing
- The README shows utilities for mocking gRPC servers and invoking gRPC methods from tests. · github.com, 4 Oct 2026
- Server mocks
- It lets tests mock a gRPC server and configure expectations for methods, headers, and payloads. · github.com, 5 Oct 2026
- Service registration
- The server guide documents registering generated Go services, service instances, or methods without generated Go code. · github.com, 4 Oct 2026
- Streaming
- It supports unary, client-streaming, server-streaming, and bidirectional-streaming methods. · github.com, 5 Oct 2026
- Supported method types
- The README includes examples for unary, client-streaming, server-streaming, and bidirectional-streaming methods. · github.com, 4 Oct 2026
Where grpcmock-go stands on Freedom251
- gRPC Tools#14 of 24