Keploy as a Express testing framework
Keploy tests Express applications by recording real requests through the running server and every database or HTTP call they trigger, then replaying both as assertions. The full middleware chain is exercised, because the request travelled it — no hand-built app instance, no supertest wiring.
keploy record -c "node server.js"What Keploy gives a Express team
Express 4 and 5, unchanged
Keploy wraps your real entrypoint, so the middleware stack under test is the one your server assembles. Router structure, CJS versus ESM, and TypeScript all make no difference to capture.
- Express 4 and 5
- No exported app object needed
- CJS, ESM, and TypeScript
- Any router and middleware order
Why Express 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 Express: by hand, with supertest + nock, or with Keploy
supertest binds an app the test file assembles, so middleware configured in your server entrypoint is missing. Keploy records the running process, so the app under test is the app you deploy.
Select any row for the full comparison, with code.
What you write for Express vs what Keploy records
All three produce the same assertion. Only the third still passes after the next refactor without anyone editing it.
Fast and dependency-free, and it proves nothing about whether the route is reachable, authenticated, or receiving a parsed body.
Note what is missing: helmet, the rate limiter, the auth middleware, and the error handler that server.js mounts. This app is not that app.
The rate-limit header in the response is evidence the request passed through the real stack — something a test-file-assembled app never shows.
Times are estimates for authoring one endpoint’s coverage from scratch, not measurements.
Express testing tools, compared
The options a team on Node.js 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 Express app once, replay it forever
Keploy sits below your Express 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 Express service and captures the dependency calls it makes.
What Keploy mocks for Express, with zero config
7 of the 7 dependencies a typical Express service talks to are stubbed from the recording itself — no mock classes, no fixture files, no containers in CI.
- Auto-mocked
MongoDBView page
Wire protocol under mongoose and the Mongo driver
- Auto-mocked
PostgreSQLView page
Postgres protocol under node-postgres and Prisma
- Auto-mocked
MySQLView page
MySQL protocol under mysql2 and Sequelize
- Auto-mocked
RedisView page
RESP under ioredis and node-redis
- Auto-mocked
Apache KafkaView page
Kafka protocol under kafkajs
- Auto-mocked
gRPCView page
HTTP/2 framed calls from @grpc/grpc-js
- Outbound HTTPAuto-mocked
Outbound HTTP
Any axios, undici, fetch, or got call
Your first Express test suite in under five minutes
Every command below runs against your existing Express service. Nothing in your source tree changes.
1Install the Keploy CLI
A standalone binary, not an npm package — package.json and your lockfile stay untouched.
curl -sSL https://keploy.io/install.sh | bash2Record your server
Use the entrypoint you deploy, so the middleware stack under test is the real one.
keploy record -c "node server.js"3Hit your routes
Each request becomes a test case with its Mongo and HTTP calls captured alongside it.
curl -X POST localhost:3000/orders/ord_1/confirm -H 'Content-Type: application/json' -H 'Authorization: Bearer $TOKEN' -d '{"paymentToken":"tok_123"}'4Replay in CI
Replay serves recorded dependency responses, so the runner needs no database or broker.
keploy test -c "node server.js" --delay 8
Ready to try it on your own Express service?
Works with the rest of your Express stack
Keploy records at the network layer, so framework and driver choices inside your Express app do not change how it captures traffic.
Node.js
The runtime page covers driver-level mock coverage in depth.
Mongoose
Model calls record as MongoDB wire traffic, not as method calls.
Prisma
Recorded as the Postgres or MySQL protocol the client emits.
Passport
Auth middleware runs on every recorded request, so tokens are exercised.
TypeScript
Wrap the compiled entrypoint or tsx — capture is source-agnostic.
Docker
Record in a container or on the host; replay needs neither.
Testing the rest of your stack
- 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 - 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 - 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 - 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 - 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