Let Claude Code Write Your API Tests from Real Traffic (Keploy Demo)
Tired of writing API tests and fake database responses by hand? In this demo, an AI coding agent (Claude Code) does it for you: it watches real requests to a Kubernetes app, turns them into tests, catches bugs, and checks every pull request automatically.
From a single prompt, Claude Code sets up Keploy, deploys a sample e-commerce app (Flask + MySQL), and turns real traffic into 35 tests and 162 database stand-ins, with zero code changes. We then sneak in three bugs: a changed price, a wrong status code, and a renamed field. Rerunning the tests, 32 pass and 3 fail, exactly the three. The agent fixes them, then sets up GitHub Actions so a bad pull request fails before it merges.
The prompt used (works in Claude Code, Cursor, Codex, Copilot):
Install Keploy Enterprise and follow `keploy k8s setup`.
Chapters
0:00 An AI coding agent sets everything up
0:12 Install Keploy on Kubernetes (Docker Desktop)
0:25 Sample app: e-commerce microservices (Flask + MySQL)
0:33 Deploy the app and start watching real requests
0:50 35 tests created from real traffic
1:04 What's inside a test (requests, responses, database data)
1:19 Sneaking in 3 bugs on purpose
1:31 Rerunning the tests on the new code
1:46 Results: 32 pass, 3 fail, and what broke
2:08 The agent fixes the bugs
2:16 Checking every pull request with GitHub Actions
2:43 A bad pull request gets blocked before merge
What is Keploy?
Keploy is an open-source (Apache 2.0) API testing agent that turns real traffic into test cases and mocks with zero code changes. Kubernetes Live Record & Replay, part of Keploy Enterprise, records live cluster traffic and replays it in an isolated sandbox, locally or in CI.
Links
Kubernetes quickstart: https://keploy.io/docs/quickstart/k8s-proxy/
Keploy on GitHub: https://github.com/keploy/keploy
#APITesting #ClaudeCode #Kubernetes