Keploy as a NATS testing framework
Keploy tests NATS publishers and subscribers by recording the NATS protocol beneath your client, capturing published subjects, delivered messages, and request-reply exchanges, then replaying them during tests. No nats-server runs and no JetStream stream is created.
keploy record -c "./orders-service"What Keploy gives a NATS team
Captured at the NATS protocol
Keploy records the text protocol beneath your client, so publishes replay with their real subject and payload, subscriptions with their delivered messages, and request-reply with the responder's actual reply.
- Below nats.go, nats.py, nats.js, and jnats
- Subjects and payloads preserved
- Request-reply exchanges captured
- Queue group deliveries recorded
Why NATS integration tests slow teams down
The friction is rarely the assertions. It is everything around them — spinning up dependencies, keeping mocks honest, and repairing tests after every refactor.
Testing NATS: by hand, with an embedded nats-server, or with Keploy
An embedded server gives real subject semantics and leaves every subscriber test waiting on asynchronous delivery. Keploy records the exchanges once and replays them deterministically.
Select any row for the full comparison, with code.
What you write for NATS vs what Keploy records
All three produce the same assertion. Only the third still passes after the next refactor without anyone editing it.
The reply is a literal, so a missing responder or an unmatched subject passes here and silently times out in production.
Real subject matching and fast startup — and the assertion still hangs on a two-second wait that fails under CI load.
The reply came from the real responder and the inbox subject is recorded, so a subject mismatch surfaces as a diff with no waiting.
Times are estimates for authoring one endpoint’s coverage from scratch, not measurements.
NATS testing tools, compared
The options a team on message brokers actually reaches for, and where each one genuinely wins. Select a row for the full comparison.
Assessments reflect each tool’s documented behaviour, not benchmark measurements.
Record your NATS app once, replay it forever
Keploy sits below your NATS process at the network layer. It watches the calls your app already makes, then serves them back on replay so tests run with no dependencies attached.
Keploy records a GET call to /api/v1/orders/{id} on a NATS service and captures the dependency calls it makes.
NATS clients Keploy records, driver by driver
Keploy captures NATS at the wire protocol, so 4 of these 6 clients need no adapter, no test double, and no NATS instance in CI.
Your first NATS test suite in under five minutes
Every command below runs against your existing NATS service. Nothing in your source tree changes.
1Install the Keploy CLI
A single binary. It needs a Linux kernel with eBPF support, or Docker on macOS and Windows — and it adds nothing to your project's dependencies.
curl -sSL https://keploy.io/install.sh | bash2Record your service
Pass the command you already use to start the app. Keploy runs it and watches every socket it opens.
keploy record -c "./orders-service"3Exercise the paths you care about
Trigger the endpoint that publishes, then let your subscriber handle the message so both halves of the exchange are recorded.
curl -X POST localhost:8080/orders/ord_1/confirm -d '{"paymentToken":"tok_123"}'4Replay in CI
Replay serves the recorded dependency responses, so the job needs no service containers and no Docker daemon.
keploy test -c "./orders-service" --delay 8
Ready to try it on your own NATS service?
Works with the rest of your NATS stack
Keploy records at the network layer, so framework and driver choices inside your NATS app do not change how it captures traffic.
Go
nats.go publishes and subscriptions record identically.
Python
nats-py traffic records at the protocol layer.
Node.js
nats.js request-reply exchanges record in full.
Apache Kafka
The queue page covers Kafka's protocol in depth.
RabbitMQ
The queue page covers AMQP capture in depth.
Kubernetes
Record inside a pod; replay needs no service mesh.
Testing the rest of your stack
- Message Queues
Keploy as a Apache Kafka testing framework
Test producers and consumers against recorded broker exchanges — no embedded Kafka, no Testcontainers cluster, no flaky poll loops.
Read the guide - Message Queues
Keploy as a RabbitMQ testing framework
Test publishers and consumers against recorded AMQP exchanges, with no broker to start and no queue to declare.
Read the guide - Languages
Keploy as a Go testing framework
Record a running Go binary once and get table-test-grade coverage with sqlmock-free database stubs and no httptest servers to maintain.
Read the guide - Languages
Keploy as a Node.js testing framework
Replace nock registrations and in-memory database fixtures with tests recorded from the traffic your Node service already serves.
Read the guide - Languages
Keploy as a Python testing framework
Turn the requests your Python service already handles into a pytest-grade regression suite, with every dependency mocked from the recording.
Read the guide - Cloud & Infra
Keploy as a gRPC testing framework
Record real gRPC exchanges over HTTP/2 and replay them as tests — no in-process stub server, no hand-written mock service implementation.
Read the guide
Join our GlobalCommunity
Connect with developers worldwide. Follow updates, ask questions, share feedback, and ship faster with other Keploy builders.
“Best report of integration and API tests I've seen — which we don't get from RestAssured.”
G2“Future of microservices testing. I don't write tests now!”
G2 · 5/5“An amazing product that simplifies the automation.”
Gartner · 4.0