Keploy as a Java testing framework
Keploy tests Java applications by recording real HTTP and JDBC traffic at the network layer, then replaying it as assertions. You add no annotations, no test dependencies, and no Docker containers — Keploy runs your existing JAR and turns observed behaviour into a regression suite.
keploy record -c "java -jar orders.jar"What Keploy gives a Java team
Any JVM service, unchanged
Keploy runs the JAR you already deploy. Spring Boot, Quarkus, Micronaut, Dropwizard, and plain servlet apps all record the same way, because capture happens at the socket rather than inside the framework.
- JVM 8 and above, any build tool
- No annotations and no test-scoped dependencies
- Works with an embedded server or a WAR on Tomcat
- Reactive and blocking endpoints record identically
Why Java 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 Java: by hand, with JUnit + Mockito, or with Keploy
JUnit and Mockito describe behaviour you already understand. Keploy derives it from traffic your service already served — so coverage grows without anyone writing a test class.
Select any row for the full comparison, with code.
What you write for Java vs what Keploy records
All three produce the same assertion. Only the third still passes after the next refactor without anyone editing it.
Two fake classes exist only to serve this test. Both encode a guess about the real dependency, and neither fails when that guess goes stale.
Correct and idiomatic — but the runner now needs a Docker daemon, and the payment stub is still a hand-written assumption about the upstream contract.
The mocks block is the real payment response and the real JDBC result set. When either contract changes, the recording changes with it.
Times are estimates for authoring one endpoint’s coverage from scratch, not measurements.
Java testing tools, compared
The options a team on the JVM 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 Java app once, replay it forever
Keploy sits below your Java 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 Java service and captures the dependency calls it makes.
What Keploy mocks for Java, with zero config
7 of the 8 dependencies a typical Java service talks to are stubbed from the recording itself — no mock classes, no fixture files, no containers in CI.
- Auto-mocked
MySQLView page
MySQL wire protocol via JDBC
- Auto-mocked
PostgreSQLView page
PostgreSQL frontend/backend protocol
- Auto-mocked
MongoDBView page
MongoDB wire protocol
- Auto-mocked
RedisView page
RESP over TCP
- Auto-mocked
Apache KafkaView page
Kafka producer and consumer protocol
- Auto-mocked
gRPCView page
HTTP/2 framed gRPC calls
- Outbound HTTPAuto-mocked
Outbound HTTP
Any RestTemplate, WebClient, or OkHttp call
- Partial
Amazon S3
S3 REST API over HTTPS
Your first Java test suite in under five minutes
Every command below runs against your existing Java service. Nothing in your source tree changes.
1Install the Keploy CLI
One binary. It needs a Linux kernel with eBPF support, or Docker on macOS and Windows.
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 the sockets.
keploy record -c "java -jar target/orders-1.0.0.jar"3Exercise the endpoints you care about
Use curl, Postman, your frontend, or a smoke script. Every request becomes a test case with its dependency calls attached.
curl -X POST localhost:8080/orders/ord_1/confirm -H 'Content-Type: application/json' -d '{"paymentToken":"tok_123"}'4Replay the suite in CI
Replay needs no database and no broker, so it drops into any runner as a single step.
keploy test -c "java -jar target/orders-1.0.0.jar" --delay 10
Ready to try it on your own Java service?
Works with the rest of your Java stack
Keploy records at the network layer, so framework and driver choices inside your Java app do not change how it captures traffic.
Spring Boot
Recorded through the embedded server — no test slices needed.
Quarkus
Native or JVM mode; capture happens outside the runtime.
Hibernate
JPA queries are captured as the SQL they emit, not as ORM calls.
Apache Maven
Replay is a CLI step, so no plugin or surefire config changes.
Gradle
Same — wrap bootRun or the built JAR and record.
Apache Tomcat
Works with a WAR on a standalone Tomcat as well as embedded.
Testing the rest of your stack
- Frameworks
Keploy as a Spring Boot testing framework
Skip @SpringBootTest context loads and @MockBean wiring — record the running application and replay every layer from real traffic.
Read the guide - Databases
Keploy as a MySQL testing framework
Mock MySQL at the wire protocol instead of standing up a container or swapping in H2 — the rows your queries really returned, replayed.
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 - 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 - 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
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