Keploy as a Django testing framework
Keploy tests Django applications by recording real requests through the running server and every ORM query, cache read, and outbound HTTP call they trigger, then replaying all of it as assertions. Django's test runner never creates a database, because there is no test database to create.
keploy record -c "python manage.py runserver"What Keploy gives a Django team
Django 3.2 and above, unchanged
Keploy starts the app through runserver or gunicorn. Function views, class-based views, Django REST Framework, and Django Ninja all record identically because capture happens at the socket.
- Django 3.2 and above
- runserver or gunicorn
- DRF viewsets and serializers
- No TestCase subclass needed
Why Django 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 Django: by hand, with Django TestCase + test Client, or with Keploy
Django's test runner buys its fidelity with a test database, a full migration run, and a fixture layer. Keploy captures the SQL your ORM emitted instead, so replay never opens a connection.
Select any row for the full comparison, with code.
What you write for Django vs what Keploy records
All three produce the same assertion. Only the third still passes after the next refactor without anyone editing it.
Two monkeypatches against import paths, and a request built by hand. Middleware, authentication, and the ORM are all absent from what this proves.
Correct and idiomatic — but it needs a test database, every migration applied, a fixture file, and a Stripe body typed out by hand.
The mock is the SQL the ORM actually generated, so a query change caught by a re-record shows up as a real diff instead of a passing fixture.
Times are estimates for authoring one endpoint’s coverage from scratch, not measurements.
Django testing tools, compared
The options a team on Python 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 Django app once, replay it forever
Keploy sits below your Django 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 Django service and captures the dependency calls it makes.
What Keploy mocks for Django, with zero config
6 of the 7 dependencies a typical Django 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 beneath the Django ORM
- Auto-mocked
MySQLView page
MySQL protocol beneath the Django ORM
- Auto-mocked
RedisView page
RESP under django-redis and the cache framework
- Auto-mocked
MongoDBView page
Wire protocol under PyMongo, for non-ORM access
- Auto-mocked
Apache KafkaView page
Kafka protocol under kafka-python
- Outbound HTTPAuto-mocked
Outbound HTTP
Any requests or httpx call from a view or task
- Partial
Celery brokers
Task enqueue over the broker protocol
Your first Django test suite in under five minutes
Every command below runs against your existing Django service. Nothing in your source tree changes.
1Install the Keploy CLI
A standalone binary — nothing is added to requirements.txt and no settings change is needed.
curl -sSL https://keploy.io/install.sh | bash2Record your Django server
Use runserver locally or gunicorn to match production more closely. Either records identically.
keploy record -c "python manage.py runserver 8000"3Exercise your endpoints
Each request becomes a test case with the ORM queries and upstream HTTP calls it triggered attached.
curl -X POST localhost:8000/orders/ord_1/confirm -H 'Content-Type: application/json' -H 'Authorization: Token $TOKEN' -d '{"payment_token":"tok_123"}'4Replay in CI
No services: block, no migrate step — replay answers every database call from the recording.
keploy test -c "python manage.py runserver 8000" --delay 10
Ready to try it on your own Django service?
Works with the rest of your Django stack
Keploy records at the network layer, so framework and driver choices inside your Django app do not change how it captures traffic.
Python
The language page covers driver-level mock coverage in depth.
Django REST Framework
Serializers and viewsets run on every recorded request.
Celery
Task enqueues appear as broker traffic on the recording.
Gunicorn
Record through gunicorn to exercise the production worker path.
PostgreSQL
ORM queries record as the SQL Django generates.
Docker
Record in a container or on the host; replay needs neither.
Testing the rest of your stack
- 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 - 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 - 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 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 - 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
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