Skip to the content
Know your tech before you buy it. Makers: get listed from $49/mo

grpcmock-go

github.com

  • Free plan
  • Linux
  • Self-hosted
7.2 Club score Visit github.com

What grpcmock-go is

grpcmock-go is a Go library of utilities for testing gRPC clients and servers. Tests can set up a mock server with expectations for methods, headers, and payloads, and can invoke gRPC methods through client helpers. It supports unary, client-streaming, server-streaming, and bidirectional-streaming methods. Request matching can use exact values, regular expressions, JSON, or custom matchers; mock responses can return payloads or errors, or run custom handlers. Services may be registered from generated Go code, as service instances, or by method without generated code. For in-memory tests, examples use bufconn listeners and context dialers, and the project recommends MockServerWithBufConn when testing an application against a mock server. Installation uses `go get go.nhat.io/grpcmock`; Go 1.25 or later is required. The module is free under the MIT license and is listed for Linux and self-hosted use.

Who it suits

It suits Go developers writing tests for gRPC clients, servers, or applications that need an in-memory mock server. It requires Go 1.25 or later.

Good to know, and what to watch

  • Supports four gRPC method types.
  • Offers exact, regex, JSON, and custom matchers.
  • Mocks can return payloads, errors, or custom responses.
  • Can register services without generated Go code.
  • Free under the MIT license.
  • Requires Go 1.25 or later.
  • Listed for Linux and self-hosted use.

Open-source Go module

Free

Free plan

Getting started

  1. Install Go 1.25 or later
  2. Run `go get go.nhat.io/grpcmock`
  3. Create gRPC server or client tests in your Go project
  4. Configure mock expectations, matchers, responses, or handlers
  5. Use MockServerWithBufConn and bufconn connections for in-memory tests

Limits to check

Use requires Go 1.25 or later. The listed module is intended for Linux and self-hosted use.

The verdict

grpcmock-go provides tools for testing a range of gRPC interactions, including streaming calls and in-memory server connections. Go 1.25 or later is a prerequisite.

Questions people ask

What does grpcmock-go cost?

Its Open-source Go module plan is listed as free.

What does grpcmock-go test?

It provides utilities for mocking gRPC servers and invoking gRPC methods from Go tests, including unary and three streaming method types.

How can requests be matched?

The server utilities support exact, regular-expression, JSON, and custom matchers.

Can mocks return custom results?

Yes. Mocks can return payloads or errors, and can use custom handlers. Streaming client invocations can also use custom handlers.

Is grpcmock-go open source?

The repository identifies its license as MIT.

How is grpcmock-go installed?

The README gives `go get go.nhat.io/grpcmock` as the installation command.

What the maker publishes

Client calls
It provides helpers to invoke gRPC methods from tests. source
Custom handlers
Streaming client invocations can use custom handlers. source
Donation
The README invites users to buy the maintainer a coffee if the project saved development time. source
Funding
The README invites users who saved development time to buy the maker a cup of coffee. source
In-memory connections
Examples use gRPC bufconn listeners and context dialers for test connections. source
In-memory testing
The server guide recommends MockServerWithBufConn for testing an application with a mocked gRPC server. source
Install
The README gives `go get go.nhat.io/grpcmock` as the installation command. source
Installation
The README gives `go get go.nhat.io/grpcmock` as the installation command. source
License
The repository identifies its license as MIT. source
License
The repository identifies its license as MIT. source
Maintainer
The repository is published under the GitHub account nhatthm. source
Mock responses
The server guide says mocks can return errors, payloads, or use custom handlers. source
Prerequisite
The README lists Go 1.25 or later as a prerequisite. source
Purpose
grpcmock describes itself as gRPC test utilities for Golang. source
Purpose
grpcmock is a set of gRPC test utilities for Golang. source
Release
GitHub lists v0.34.0, released December 12, 2025, as the latest release. source
Request matching
The server guide documents exact, regular-expression, JSON, and custom matchers for matching values. source
Requirement
The repository README lists Go 1.25 or later as a prerequisite. source
Server and client testing
The README shows utilities for mocking gRPC servers and invoking gRPC methods from tests. source
Server mocks
It lets tests mock a gRPC server and configure expectations for methods, headers, and payloads. source
Service registration
The server guide documents registering generated Go services, service instances, or methods without generated Go code. source
Streaming
It supports unary, client-streaming, server-streaming, and bidirectional-streaming methods. source
Supported method types
The README includes examples for unary, client-streaming, server-streaming, and bidirectional-streaming methods. source

Checked against the maker's pages on 5 Oct 2026.