FREEDOM251

Freedom251 › gRPC Tools

grpcmock

Paid Self-hosted

Visit grpcmock Alternatives

grpcmock's own site

What grpcmock is

grpcmock, also called gRPC Mock, is a free, open-source Java tool for mocking gRPC service endpoints in unit and integration tests. Developers configure method stubs with a fluent Java API and can match requests using headers and bodies. Responses can be delayed, and later invocations can return different responses. The tool supports unary, server-streaming, client-streaming, and bidirectional-streaming methods. Tests can verify calls by checking invocation counts, status, headers, and request messages. The grpcmock-spring-boot module integrates it with Spring Boot tests, while grpcmock-junit5 provides JUnit 5 extensions, including an in-process server option. With the JUnit 5 extensions, mappings are cleared after each test and the server shuts down when the test class finishes. grpcmock is self-hosted and licensed under Apache-2.0. A concurrency caveat applies when setup and test code run on different threads: static configuration methods use a ThreadLocal instance and can produce UNIMPLEMENTED errors in multithreaded test setups. The documentation recommends accessing a GrpcMock instance in that situation.

Who it suits

grpcmock suits Java developers writing unit or integration tests for gRPC services. It is especially relevant to teams using Spring Boot or JUnit 5 tests.

What it does well

  • Configures stubs through a fluent Java API.
  • Supports all four gRPC method styles.
  • Verifies invocation counts, status, headers, and requests.
  • Provides Spring Boot and JUnit 5 integrations.

What to know first

  • Self-hosted deployment is required.
  • Static configuration can cause UNIMPLEMENTED errors across threads.

Limits

In multithreaded test setups, static configuration methods use a ThreadLocal instance and may produce UNIMPLEMENTED errors. The documentation recommends accessing a GrpcMock instance when setup and test methods run on different threads.

Getting started

  1. Visit grpcmock.org
  2. Use the self-hosted project in your Java test environment
  3. Configure gRPC method stubs with the fluent Java API
  4. Add grpcmock-spring-boot for Spring Boot tests when needed
  5. Add grpcmock-junit5 for JUnit 5 extensions and in-process server use
  6. Define request matching, responses, and invocation checks

Verdict

grpcmock provides controls for simulating gRPC calls and checking how tests invoke them. Multithreaded test setups should account for its ThreadLocal configuration behavior.

Questions

What does grpcmock cost?

grpcmock is free and open source. Its GitHub project identifies the Apache-2.0 license.

Where does grpcmock run?

It uses a self-hosted deployment model.

Which gRPC methods are supported?

It supports unary, server streaming, client streaming, and bidirectional streaming methods.

Does grpcmock integrate with Spring Boot and JUnit 5?

Yes. Separate modules provide Spring Boot integration and JUnit 5 extensions, including an in-process server option.

What can tests verify?

Tests can verify invocation counts, status, headers, and request messages for method calls.

What happens to mappings in JUnit 5 tests?

The JUnit 5 extensions clear mappings after each test and shut down the server after the test class finishes.

Facts from grpcmock's own pages

Concurrency limitation
In multithreaded test setups, static configuration methods can produce UNIMPLEMENTED errors because gRPC Mock uses a ThreadLocal instance. · grpcmock.org, 4 Oct 2026
Configuration
It configures stubs through a fluent Java API and can match request headers and bodies. · grpcmock.org, 8 Oct 2026
gRPC methods
It supports unary, server streaming, client streaming, and bidirectional streaming methods. · grpcmock.org, 8 Oct 2026
In-process option
Spring Boot and JUnit 5 examples show how to run an in-process server for tests. · grpcmock.org, 8 Oct 2026
Intended users
The project describes itself as a tool for Java developers writing integration or unit tests for gRPC services. · grpcmock.org, 8 Oct 2026
Invocation verification
Tests can verify method invocations, including status, headers, requests, and invocation counts. · grpcmock.org, 8 Oct 2026
JUnit 5 integration
The grpcmock-junit5 module provides JUnit 5 extensions, including an in-process server option. · grpcmock.org, 8 Oct 2026
JUnit integration
The grpcmock-junit5 module provides JUnit 5 extensions, including an in-process server option. · grpcmock.org, 4 Oct 2026
License
The project’s GitHub page identifies its license as Apache-2.0. · github.com, 8 Oct 2026
Matching
Stubs can match request headers and request bodies. · grpcmock.org, 4 Oct 2026
Multithreaded tests
The documentation says static configuration methods use a ThreadLocal instance and recommends accessing a GrpcMock instance when setup and test methods run on different threads. · grpcmock.org, 8 Oct 2026
Project status
The site describes gRPC Mock as open source. · grpcmock.org, 4 Oct 2026
Purpose
gRPC Mock is a Java testing tool for mocking gRPC service endpoints in integration or unit tests. · grpcmock.org, 8 Oct 2026
Response behavior
Individual responses can have configurable delays, and stubs can return different responses on subsequent invocations. · grpcmock.org, 8 Oct 2026
Spring Boot integration
The grpcmock-spring-boot module integrates gRPC Mock with Spring Boot tests. · grpcmock.org, 8 Oct 2026
Stubbing
It configures gRPC method stubs through a fluent Java API. · grpcmock.org, 4 Oct 2026
Supported methods
It supports unary, server streaming, client streaming, and bidirectional streaming methods. · grpcmock.org, 4 Oct 2026
Test lifecycle
With the documented JUnit 5 extensions, stubs are cleared after each test and the server shuts down after the test class finishes. · grpcmock.org, 8 Oct 2026
Verification
Tests can verify method invocations, including invocation counts, status, headers, and request messages. · grpcmock.org, 4 Oct 2026

Where grpcmock stands on Freedom251

Look at these too