Keploy as a MySQL testing framework
Keploy mocks MySQL by recording the MySQL wire protocol beneath your driver, capturing the exact result sets your queries returned, and replaying them during tests. No MySQL instance runs in CI, no schema is created, and no seed script or H2 substitute is involved.
keploy record -c "java -jar orders.jar"What Keploy gives a MySQL team
Captured at the MySQL client/server protocol
Keploy reads the protocol beneath your driver, so the result sets that replay are the bytes MySQL actually sent — including the column names and types the server reported in its result metadata.
- Below JDBC, mysql2, PyMySQL, go-sql-driver
- Column types from the server's own metadata
- Prepared statements and parameter binding
- Transactions replay in order
Why MySQL 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 MySQL: by hand, with Testcontainers MySQL, or with Keploy
Testcontainers is the honest answer, and it charges for it in CI: a Docker runtime, an image pull, and a server boot per job. Keploy records that server once and replays its responses.
Select any row for the full comparison, with code.
What you write for MySQL vs what Keploy records
All three produce the same assertion. Only the third still passes after the next refactor without anyone editing it.
The repository interface exists only so this stub can be substituted. No query is parsed, so a syntax error or a missing index is invisible until production.
Real SQL semantics, and every CI job that touches this class now needs a Docker daemon, an image pull, and a server boot before the first assertion.
Column types and row values are what MySQL sent, not what a developer assumed. No repository interface is needed, so the production code keeps its concrete class.
Times are estimates for authoring one endpoint’s coverage from scratch, not measurements.
MySQL testing tools, compared
The options a team on relational databases 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 MySQL app once, replay it forever
Keploy sits below your MySQL 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 MySQL service and captures the dependency calls it makes.
MySQL clients Keploy records, driver by driver
Keploy captures MySQL at the wire protocol, so 6 of these 8 clients need no adapter, no test double, and no MySQL instance in CI.
- Auto-mocked
JavaView page
MySQL Connector/J and Spring Data JDBC
- Auto-mocked
Node.jsView page
mysql2, Sequelize, and Prisma
- Auto-mocked
PythonView page
mysqlclient, PyMySQL, and SQLAlchemy
- Auto-mocked
GoView page
go-sql-driver/mysql and GORM
- Auto-mocked
Spring BootView page
Spring Data JPA over Hibernate
- Auto-mocked
DjangoView page
The Django ORM's MySQL backend
- Partial
PHP
PDO_MySQL and mysqli
- Partial
.NET
MySqlConnector and Entity Framework Core
Your first MySQL test suite in under five minutes
Every command below runs against your existing MySQL service. Nothing in your source tree changes.
1Install the Keploy CLI
One binary on the machine that will do the recording. Nothing is installed into MySQL itself.
curl -sSL https://keploy.io/install.sh | bash2Record with your development database reachable
Run the app as usual. Every query it issues and every result set MySQL returns is captured together.
keploy record -c "java -jar orders.jar"3Exercise the paths that hit the database
Reads, writes, transactions, and prepared statements are all recorded with their parameters and responses.
curl localhost:8080/orders/ord_1curl -X POST localhost:8080/orders/ord_1/confirm -d '{"paymentToken":"tok_123"}'4Replay with MySQL switched off
Stop MySQL entirely and run the suite. If replay passes, the mocks are answering every query your code makes.
keploy test -c "java -jar orders.jar" --delay 15
Ready to try it on your own MySQL service?
Works with the rest of your MySQL stack
Keploy records at the network layer, so framework and driver choices inside your MySQL app do not change how it captures traffic.
Java
Connector/J traffic records without a driver wrapper.
Spring Boot
Spring Data queries record as the SQL Hibernate emits.
Node.js
mysql2, Sequelize, and Prisma all record identically.
Go
database/sql and GORM record at the protocol below the driver.
Django
The ORM's MySQL backend records as generated SQL.
Flyway
Migrations still run against a real MySQL; only tests use mocks.
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 - Languages
Keploy as a Java testing framework
Generate JUnit-grade integration tests for any JVM service by recording the traffic it already serves.
Read the guide - 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 - 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 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 - Frameworks
Keploy as a Django testing framework
No test database to create and destroy, no fixtures to load — Keploy records your Django app serving real requests and replays the ORM queries it made.
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