Keploy as a Rust testing framework
Keploy tests Rust services by recording real HTTP and database traffic from a running binary, then replaying it as assertions. There are no traits to extract for mockall, no wiremock server to stand up per upstream, and no sqlx test database to migrate.
keploy record -c "./target/release/orders"What Keploy gives a Rust team
Any Rust binary, unchanged
Keploy runs the binary cargo builds. Axum, Actix Web, Rocket, and warp all record the same way, because interception happens at the socket rather than inside the router or the async runtime.
- Stable Rust, any edition
- Tokio and async-std both fine
- No cfg(test) entrypoint
- HTTP and gRPC servers supported
Why Rust 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 Rust: by hand, with mockall + wiremock, or with Keploy
mockall needs a trait to generate from and wiremock needs a handler you write. Keploy captures outside the process, so production signatures stay clean and no upstream contract is written down twice.
Select any row for the full comparison, with code.
What you write for Rust vs what Keploy records
All three produce the same assertion. Only the third still passes after the next refactor without anyone editing it.
Two traits exist in production code purely so these two fakes can be substituted. Neither fake fails when the real contract changes.
Compile-time-checked and fast — and the Stripe body is still a literal in test code, and MockOrderRepo still needs a trait in production to generate from.
The SQL and the upstream response are recorded, not restated — and the handler's signature keeps its concrete types because nothing had to become a trait.
Times are estimates for authoring one endpoint’s coverage from scratch, not measurements.
Rust testing tools, compared
The options a team on Rust 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 Rust app once, replay it forever
Keploy sits below your Rust 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 Rust service and captures the dependency calls it makes.
What Keploy mocks for Rust, with zero config
7 of the 7 dependencies a typical Rust service talks to are stubbed from the recording itself — no mock classes, no fixture files, no containers in CI.
- Auto-mocked
PostgreSQLView page
Postgres protocol under sqlx and tokio-postgres
- Auto-mocked
MySQLView page
MySQL protocol under sqlx
- Auto-mocked
RedisView page
RESP under redis-rs
- Auto-mocked
MongoDBView page
Wire protocol under the mongodb crate
- Auto-mocked
Apache KafkaView page
Kafka protocol under rdkafka
- Auto-mocked
gRPCView page
HTTP/2 framed calls from tonic
- Outbound HTTPAuto-mocked
Outbound HTTP
Any reqwest or hyper client call
Your first Rust test suite in under five minutes
Every command below runs against your existing Rust 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 "./target/release/orders"3Exercise the paths you care about
Build as normal, then drive the binary. Every request becomes a test case with its sqlx and reqwest calls captured alongside.
cargo build --releasecurl -X POST localhost:8080/orders/ord_1/confirm -H 'Content-Type: application/json' -d '{"payment_token":"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 "./target/release/orders" --delay 8
Ready to try it on your own Rust service?
Works with the rest of your Rust stack
Keploy records at the network layer, so framework and driver choices inside your Rust app do not change how it captures traffic.
Axum
Recorded through the HTTP server — extractors run as they really do.
Actix Web
Same capture path; middleware order makes no difference.
sqlx
Queries record as the SQL they emit, with the rows returned.
Tokio
Capture is below the runtime, so task scheduling is irrelevant.
tonic
Unary and server-streaming gRPC calls captured as HTTP/2 frames.
PostgreSQL
The database page covers protocol-level capture in depth.
Testing the rest of your stack
- Databases
Keploy as a PostgreSQL testing framework
Record the Postgres frontend/backend protocol once and replay real result sets in tests — no container, no pg-mem, no schema to rebuild.
Read the guide - Caches & Stores
Keploy as a Redis testing framework
Record RESP traffic once and replay real cache hits, misses, TTLs, and pipeline responses without a Redis server in CI.
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 - 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 - 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 - Databases
Keploy as a MongoDB testing framework
Mock MongoDB at the wire protocol — real documents, real BSON types, real aggregation results — without a mongod binary in CI.
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