grpc-mocklisted
Install: claude install-skill testland/qa-skills
# grpc-mock
## Overview
Mocking a gRPC server lets client-side tests exercise success
paths, every `grpc.StatusCode` (per the status-code catalog in
`grpc-streaming-test-author`, references/status-codes.md),
timeouts, and streaming sequences without a real backend. The
in-process harness is also the substrate for interceptor tests -
see [references/interceptors.md](references/interceptors.md).
Three approaches dominate, picked by language:
| Approach | Mechanism |
|---|---|
| **In-process gRPC server** | A real `grpc.Server` listens on an in-memory transport (`bufconn` in Go, `InProcessServerBuilder` in JVM). Tests exercise the full client stack. |
| **Interface mock** | `mockgen` / `gomock` (Go) / Mockito (JVM) / `unittest.mock` (Python) replace the generated client stub with a programmable mock. Faster but skips marshalling. |
| **Standalone mock server** | Run a tool like `grpcmock` / `dishwasher` as a subprocess. Cross-language client testing. |
## When to use
- Client-side tests need controllable gRPC responses (success +
error matrix).
- Streaming-RPC tests need a server that sends a deterministic
sequence.
- Mid-test failure injection (deadline / cancellation / status
code).
- Tests must not depend on a running backend (offline CI).
- Cross-service contract testing: want the client to see what
the contract says, not what the current server happens to do.
## Authoring
### Go: bufconn + in-process server
Per
[pkg.go.dev/google.golang.org/grpc/test/bufcon