grpc-mock
Installation
SKILL.md
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.
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. |