Universal Mocker
Universal Mocker is Keploy's service virtualization for the tests you
already have. You run your own test command under keploy mock record once,
with the real dependencies up. Keploy saves every call your tests make to
databases, queues and other services, with each answer. After that,
keploy mock replay runs the same command with those dependencies switched off
and answers each call from the recording.
You write no mock code, and you change no test. Your test framework still decides which tests pass.
Understand how it works
-
Record. Run
keploy mock record -c "<your test command>". Your tests run against the real dependencies. Keploy sits between the two and saves each outgoing call and its answer. -
Replay. Run
keploy mock replay -c "<your test command>". The dependencies can be off. Keploy answers each call with its recorded answer. By default, a call that matches no recording fails the run (--on-miss fail), so a missing mock never passes silently. -
Check every test on its own (optional). With
KEPLOY_PROVEN=1,keploy mock recordalso replays each test with the dependencies off before it keeps the recording. A test that doesn't replay is set aside, with the reason and the next step. See Prove each test offline. -
Share. In that mode, when you are signed in, the recordings go to Keploy Cloud, under a Keploy branch named after your git branch. Two things must be true:
keploy.ymlnames a Keploy app (mock.appId). Runkeploy app createfirst, or record once with--app <name>.- You record on a git branch other than main. Keploy never publishes to
main: switch to a branch first (
git switch -c <name>), or pass--branch <name>.
Your repository holds only
keploy.ymlandkeploy.lock, which pins each test to its recordings. CI replays whatkeploy.lockpins.
Choose the right Keploy product
| You want to… | Use |
|---|---|
| Run the tests you already have (unit, integration, e2e) without their databases, queues and APIs | Universal Mocker (keploy mock) |
| Turn real traffic from a running app or a cluster into tests and mocks | Integration Testing (keploy record, k8s-proxy) |
| Generate API tests from a schema, a collection or live traffic with AI | API Testing |
The difference is who owns the tests. With Universal Mocker, your team owns the tests and records whenever a branch needs it. With Integration Testing, Keploy captures tests from an environment's traffic.
Check what it supports
Test commands. Any command that runs your tests: go test, pytest,
npx jest, mvn test, npx playwright test, or a shell script. Keploy wraps
the command and doesn't need to know the framework.
Per-test checks (KEPLOY_PROVEN=1) need each test to say where it starts
and ends:
- Go:
github.com/keploy/go-sdk/v3. - Playwright:
@keploy/playwright. - Any other framework: two HTTP calls per test, as Per-test scoping shows.
Platforms.
| Platform | Record and replay | Per-test checks (KEPLOY_PROVEN=1) | Notes |
|---|---|---|---|
| Linux | Yes | Yes | Keploy's agent runs as root; Keploy starts it with sudo. |
| macOS (Apple silicon) | Yes | Yes | No sudo or admin rights needed. |
| Docker | Yes | Not yet | Pass a docker run or docker compose command. |
| Windows | Coming soon | Coming soon | Native Windows support, VS Code included, is coming. |
Dependencies in Keploy 3.9.3. "Docker" means: run the tests through a Docker command so Keploy reads the calls on Linux.
| Dependency | Linux | macOS |
|---|---|---|
| HTTP and HTTPS, HTTP/2 | Yes | Yes |
| gRPC | Yes | Yes |
| PostgreSQL | Yes | Yes |
| MySQL | Yes | Yes |
| MongoDB | Yes | Yes |
| Amazon DynamoDB | Yes | Yes |
| Aerospike | Yes | Yes |
| Redis | Yes | Docker |
| Kafka | Yes | Docker |
| Memcached | Yes | Docker |
| Apache Pulsar | Yes | Docker |
| Amazon SQS | Yes | Docker |
| Couchbase, HBase, Apache ZooKeeper | Yes | Docker |
A call to any other TCP service is saved as raw bytes. It replays only when your tests send exactly the same bytes again.
Use it from VS Code
The Keploy VS Code extension installs the Keploy CLI, signs you in, and hands the project setup to your coding agent. Then you record, replay and review from the editor.
Next steps
- Go quickstart: run
go testwithout PostgreSQL or an HTTP API, then check each test on its own. - Mock your tests in 2 minutes: a walkthrough with a Python sample app.
- Mock your own tests: every option, per-test checks, CI, and sharing with your team.
- CLI commands: the full
keploycommand list.