How to use the API Contract Test Generator
Paste an OpenAPI or Swagger spec and instantly get runnable smoke tests for every operation, in the framework you use: curl, Jest + supertest, Playwright, or a Postman collection. Each test sends a request with sample path, query, and body values and asserts the operation's success status. Everything runs in your browser; nothing is uploaded.
What it does
- Extracts every path + method from the spec and builds a sample request.
- Substitutes path/query parameters and a sample JSON body from the schema.
- Emits curl, Jest + supertest, Playwright, or a Postman v2.1 collection.
- Defaults the base URL to the spec's first server (overridable).
When to use it
- Bootstrapping an API test suite from an existing contract.
- Adding a quick smoke check to CI for every endpoint.
- Producing a ready-to-run Postman/Newman collection for QA.
- Sanity-checking a new or changed spec against a running service.
How to use it
- Paste the spec and set a base URL (or use the spec's server).
- Choose a target framework.
- Copy or download the generated tests and run them.
Tips & pitfalls
- Generated bodies use sample values — replace them with real data and add auth headers.
- Tests assert only the status code; add response-schema assertions for contract enforcement.
- For Jest + supertest, point
base at your running server; for Postman, set the baseUrl variable.
FAQ
- What tests does it generate? For every operation in the spec it builds a request with sample path, query, and body values, then emits one of: curl commands, a Jest + supertest suite, Playwright API tests, or a Postman v2.1 collection. Each test asserts the operation's success status code.
- Can I paste YAML and set a base URL? Yes. Paste JSON or YAML. The base URL defaults to the first server in the spec, and you can override it — useful for pointing the tests at localhost or a staging environment.
- Is my spec uploaded anywhere? No. The spec is parsed and the tests are generated entirely in your browser. Nothing is sent to any server.
Related guides