API testing tools that generate tests from code, compared
Spec-driven fuzzers, traffic-recording tools, AI request assistants, and security-focused generators all claim to "generate API tests." A researched map of what each actually generates, from what source, and what it misses.
- "Generate tests from code" splits into four real categories: spec-driven property-based fuzzers, traffic-recording tools, AI-assisted per-request generators, and security-focused test generators — each starts from a different source and catches a different class of bug.
- Schemathesis is the open-source default for schema-aware fuzzing against an OpenAPI or GraphQL schema; Keploy is the open-source default for traffic-derived regression tests, with a paid tier adding AI-assisted generation.
- None of the general-purpose tools below test specifically for how an API behaves under the traffic shape an AI agent produces — retry storms, malformed payloads, payload bloat — by default.
- Elva generates a test suite from the code-derived catalog on every commit and runs chaos scenarios modeled on how agents actually misuse a tool call, alongside the standard positive and negative cases.
Search "API testing tools that generate tests from code" and four genuinely different products answer, because "generate" means something different in each one. Some read a schema and fuzz it. Some record real traffic and replay it. Some use AI to draft a test script from a single request you already built. Some generate security tests specifically, not functional ones. Picking from the wrong category is how a team adopts a fuzzer expecting production-traffic coverage, or a traffic recorder expecting it to test an endpoint nobody has called yet.
Four categories, one shared claim
Spec-driven property-based fuzzers. These read an OpenAPI or GraphQL schema and generate many varied inputs per endpoint automatically, searching for crashes and contract violations rather than following a script a human wrote. Schemathesis is the clearest example: an open-source (MIT-licensed) Python tool built on the Hypothesis property-based testing library, used by teams at Netflix, SAP, Red Hat, IBM, and JetBrains according to its own site, supporting OpenAPI 2.0/3.0/3.1 and GraphQL schemas, runnable in CI via a GitHub Action. Dredd sits in the same neighborhood but does a narrower job: it checks that an API's real responses conform to what an API Blueprint or OpenAPI 2 document says (OpenAPI 3 support remains experimental), across Go, Node.js, Perl, PHP, Python, Ruby, and Rust backends — a compliance check against the spec, not a broad search for edge cases the spec didn't anticipate.
Traffic-recording tools. These generate tests from what actually happened, not from a schema. Keploy captures API calls, database queries, and downstream requests at the network layer using eBPF, with no code instrumentation required, then turns the recording into a deterministic regression suite with mocks for the dependencies it saw. The core is open source (Apache 2.0); Keploy's pricing page lists a free tier, a Pro tier around $24 per user per month that adds AI-assisted test generation, and an Enterprise tier with SOC 2 and SLAs. The structural limit is the same for any recorder: coverage tracks what traffic occurred during the recording window, so an endpoint nobody called that day generates no test.
AI-assisted, per-request generators. These sit inside an existing API client and draft a test script from a single request rather than covering a whole API surface at once. Postman's Postbot, generally available since 2024, generates test assertions and can debug a failing request from a natural-language prompt, working from the shape of the request and response already open in the workspace. ReadyAPI (SmartBear's enterprise suite, the modern successor to SoapUI) has added AI-assisted snippets on top of its existing scenario-based test authoring for REST, SOAP, and complex enterprise environments. Both accelerate writing an individual test; neither automatically produces coverage for the endpoints nobody opened a request for.
Security-focused generators. A separate lane generates tests aimed specifically at vulnerabilities rather than general functional correctness. Akto discovers an API's surface from observed traffic and runs it against a library the vendor describes as 1,000+ built-in security tests covering the OWASP API Security Top 10, authentication flaws, and business-logic vulnerabilities; Akto offers a free tier alongside custom paid plans. This generates real tests automatically, but the target is security posture, not whether an endpoint behaves correctly under normal or agent-shaped use.
Design-first platforms bundle a version of this too: Apidog includes automated test generation tied to the specs a team authors inside it, alongside its mocking and documentation features — a full comparison against Elva's code-derived approach is in the Elva vs. Apidog breakdown.
The gap every general-purpose tool shares
Every tool above was built against QA-shaped or human-shaped traffic: a tester runs a scenario, a fuzzer hunts for malformed input, a recorder captures what a browser or a service actually sent. None of them, by default, tests specifically for what an AI agent does to an API: calling the same tool sixty times in eight seconds because a retry loop has no backoff, sending a payload that's subtly wrong because the agent half-understood a loosely typed field, or generating so much response text that the call itself becomes expensive for a model to read. Those are the failure modes an agent's tool calls actually produce, and a passing suite built for the old traffic shape says nothing about them.
A comparison table
| Tool | Category | Generates from | One honest limitation |
|---|---|---|---|
| Schemathesis | Spec-driven fuzzer | OpenAPI / GraphQL schema | Needs a schema to exist first; tests structure, not business logic |
| Dredd | Contract compliance checker | API Blueprint, OpenAPI 2 (OpenAPI 3 experimental) | Verifies conformance; doesn't search for edge cases beyond the spec |
| Keploy | Traffic-recording | Live traffic via eBPF | Coverage tracks recorded traffic, not the full route table |
| Postman Postbot | AI-assisted, per-request | A request already open in Postman | Accelerates authoring one test; not full-surface coverage |
| ReadyAPI | Enterprise scenario suite | Manually built scenarios + AI snippets | Enterprise pricing and setup; AI assist is incremental to human authoring |
| Akto | Security test generator | Discovered traffic → security test library | Targets OWASP-style vulnerabilities, not general functional correctness |
| Apidog | Bundled design-first testing | Specs authored inside Apidog | Tied to specs a team maintains in the platform |
| Elva | Code-derived + chaos suite | OpenAPI catalog generated from source, rescanned each commit | Validates against Elva's generated catalog, not a separately maintained spec |
Where Elva fits
Elva generates its test suite from the same code-derived OpenAPI catalog it rebuilds on every commit, so there's no separate spec to keep in sync with what gets tested. The generated suite covers the cases a schema-aware tool would produce — a payment created with a valid body, a missing amount rejected with a 400, a negative amount rejected as a boundary case, a request with no token rejected with a 401, a token missing the right scope rejected with a 403 — and then goes further into cases that matter specifically because an agent, not a person, is the caller: a duplicate submit with no idempotency key flagged as a warning, and a burst of sixty retries in eight seconds shown creating fourteen duplicate records when nothing stops it.
On top of the generated suite, Elva runs six chaos scenarios built around how agents actually misbehave: malformed payloads (wrong types, truncated JSON, extra fields), retry storms, authentication edge cases (missing, expired, wrong-scope, and revoked tokens), schema drift against the live contract, payload bloat measured in tokens per call, and latency under concurrent load. That combination — a generated functional suite plus agent-shaped chaos testing, both derived from the same source of truth as the rest of the catalog — is the gap the general-purpose tools above don't individually close.
Choosing, in practice
- Have a maintained OpenAPI schema and want broad automatic fuzzing against it? Schemathesis is the open-source standard, covering OpenAPI 2.0, 3.0, and 3.1. Dredd is the lighter-weight option for conformance checking specifically, but only for API Blueprint or OpenAPI 2 — its OpenAPI 3 support is still experimental, so a schema already on 3.x isn't its intended target.
- No schema, but real traffic to learn from? Keploy turns that traffic into a regression suite with no code changes, at the cost of only covering what got called.
- Already living in Postman or a SOAP-heavy enterprise stack? Postbot and ReadyAPI's AI snippets speed up writing tests you'd otherwise write by hand, without changing how coverage gets decided.
- Need to know whether an API is exploitable, not just whether it behaves correctly? Akto's security-specific test library is a different and complementary goal from any of the above.
- Serving AI agents as callers and need to know what happens under retry storms and malformed tool calls, not just clean QA scenarios? That's the gap chaos testing built for agent traffic is meant to close, on top of whichever functional suite already exists.
Most teams end up combining more than one of these: a spec-aware fuzzer or a code-derived suite for functional coverage, a security scanner for exploitability, and — increasingly, as more of the traffic hitting production APIs comes from agents rather than people — a suite that tests for the specific ways an agent breaks things that a human tester never would.
FAQ
Can API tests be generated automatically without writing them by hand?
Yes, from several different starting points. Schemathesis and similar tools generate tests from an OpenAPI or GraphQL schema; Keploy generates them from recorded production traffic; Postman Postbot and ReadyAPI's AI features generate individual test scripts from a request you already built. Each covers a different slice of the surface, and none covers all of it alone.
What is the difference between Schemathesis and Dredd?
Both read an OpenAPI schema, but for different purposes. Schemathesis uses property-based testing (via Hypothesis) to generate many varied inputs per endpoint and hunt for crashes and schema violations. Dredd checks that the API's real responses conform to what the schema documents — a compliance check, not a broad search for edge cases.
Does Keploy require code changes to generate tests?
No. Keploy captures traffic at the network layer using eBPF, so it records real requests, database queries, and downstream calls without instrumenting the application, then replays the recording as a regression suite. Coverage is bounded by what traffic actually occurred during recording.
Can generated tests catch how an API behaves when an AI agent misuses it?
Not by default in most of these tools, which were built for human-shaped traffic and QA-style scenarios. Agent-shaped failure modes — a call retried sixty times in eight seconds, a malformed payload from a half-understood schema, response payloads bloated with tokens an agent has to pay for — need chaos scenarios purpose-built for that traffic pattern.
How does Elva generate API tests?
From the OpenAPI catalog Elva derives from the codebase itself, rescanned on every commit, so the tests validate against what the code actually does rather than a spec someone maintains separately. Alongside standard positive, negative, boundary, and auth-scope cases, Elva runs chaos scenarios — malformed payloads, retry storms, auth edge cases, schema drift, payload bloat, and latency under load — modeled on how agents actually call tools.
Ship notes, monthly
One email with what shipped and what we learned. Unsubscribe anytime.