Mocker

Replace service dependencies with lightweight static and dynamic mocks.

About Mocker

Mocker is an in-cluster solution for creating mock API services. Mocker can be used via the VSCode Extension, the Skyramp CLI, or the various supported language libraries.

Mocker allows you to have fine-grained control over the dependencies you want to mock and comes with the following features:

  1. Ability to mock gRPC, REST, JSON-RPC WebSocket, and JSON-RPC HTTP endpoints.
  2. Automatic creation of mock configurations from API files.
  3. Dynamic routing of calls from live to mocked services.
  4. Powerful gRPC mocking including the ability to proxy gRPC calls, and support for client streaming, server streaming, and bidirectional streaming.
  5. Support for mock values generated via generative AI.
  6. Ability to configure response latencies to test and debug real-world scenarios.
  7. Out of the box support for returning error codes to test error cases.

How Mocker Works

Mocker consists of 3 parts:

  1. A container that is deployed in Docker. It contains the core logic for implementing mocks and handles networking for the mocks.
  2. A mock configuration file that captures the signatures for the endpoints you want to mock and corresponding static mock responses. It is automatically generated from one of: an OpenAPI API spec (either by file path or URL reference), a protocol buffer API spec, or a JSON-RPC response file. Mock values can be easily edited as needed.
  3. Optional Javascript runtime support to enable dynamic mocking for complex test cases.

How to Mock Services

Learn how to use Mocker to create mock API services.

Mock Description

Learn about the specific features and configurations of the Skyramp mock description.