grpc-mock
Installation
SKILL.md
grpc-mock
Overview
Mocking a gRPC server lets client-side tests exercise success
paths, every grpc.StatusCode per
grpc-status-code-mapping-reference,
timeouts, and streaming sequences without a real backend.
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. |