schemathesis
Adaptive API testing for OpenAPI and GraphQL
What it is and what it does
Schemathesis is a property-based testing framework for OpenAPI and GraphQL APIs. It reads your API schema, generates test cases covering edge cases and invalid inputs, sends them to your API, and validates that responses match the schema and don't crash. It can also chain operations together to test realistic workflows—for example, creating a resource, fetching it, and deleting it in sequence—to catch bugs that only appear when operations interact.
The package integrates with pytest and Hypothesis to run tests both from the command line and within Python test suites. It supports multiple reporting formats (Allure, JUnit XML) for CI/CD pipelines and can adapt its test generation based on server responses. With 15 runtime dependencies including click, requests, pyyaml, and rich, it provides a complete testing toolkit without requiring external tools.
Use it for:
- Catch 500 errors and crashes caused by edge-case inputs before users encounter them in production.
- Verify that your API returns data matching your OpenAPI schema and rejects invalid inputs correctly.
- Test multi-step workflows like user creation, retrieval, and deletion to find bugs in operation sequencing.
- Integrate API testing into CI/CD pipelines using GitHub Actions or other tools via JUnit XML reports.
- Fuzz-test GraphQL APIs to find schema violations and unexpected server behavior.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Schemathesis generates test cases from OpenAPI and GraphQL schemas to automatically find API bugs through property-based testing, including edge cases, schema violations, and stateful workflow failures.
Yes. Schemathesis is actively maintained, has low install friction, carries no security vulnerabilities, and uses a permissive MIT license. It solves a real problem—finding API bugs through automated schema-driven testing—and is used by established companies like Spotify, WordPress, JetBrains, and Red Hat. Install it if you own or test an OpenAPI or GraphQL API and want to catch bugs before users do.
Install
schemathesis on PyPI
pip
pip install schemathesisuv
uv add schemathesispoetry
poetry add schemathesisInstalling schemathesis
Before you install
Low friction: pure Python wheel with 15 runtime dependencies including hypothesis, pytest, and requests. Active maintenance with a release 20 days ago and 3526 GitHub stars. Supports Python 3.10 through 3.14.
License in practice
MIT license (permissive): you can use, modify, and distribute schemathesis freely in commercial and private projects with minimal restrictions.
Quickstart
pip install schemathesis
import schemathesis
schema = schemathesis.openapi.from_url("https://your-api.com/openapi.json")
@schema.parametrize()
def test_api(case):
case.call_and_validate()
Verify before relying
- Whether the package's stateful testing (as_state_machine) requires additional setup or configuration beyond the basic usage shown.
- Performance characteristics when testing large or complex OpenAPI schemas with many endpoints.
- Whether hypothesis-graphql and hypothesis-jsonschema are automatically invoked or require explicit configuration for GraphQL/JSON Schema support.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 15 — click, harfile, hypothesis-graphql, hypothesis-jsonschema, hypothesis, jsonschema-rs, pyrate-limiter, pytest, pyyaml, requests, rich, starlette-testclient, tomli, typing-extensions, werkzeug |
| Maintenance | actively maintained — 20 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,734,183/month — #1,862 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: schemathesis-4.24.3-py3-none-any.whl
Keywords: adaptive, fuzzing, graphql, hypothesis, openapi, pytest, testing
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
hypothesis-graphqlGenerates arbitrary GraphQL queries matching…
permissive · top 5,000 on PyPI
hegel-coreHegel-core provides property-based testing data…
permissive · top 15,000 on PyPI
hypothesis-jsonschemaGenerates random JSON data that conforms to a…
copyleft · top 5,000 on PyPI
hypothesisHypothesis is a property-based testing library…
copyleft · top 1,000 on PyPI
openapi-schema-pydanticProvides Pydantic classes that map to the…
permissive · top 5,000 on PyPI
quart-schemaQuart-Schema adds schema validation and…
permissive · top 15,000 on PyPI
ariadne-codegenGenerates fully typed, asynchronous Python…
permissive · top 5,000 on PyPI
datamodel-code-generatorGenerates Python data models (Pydantic,…
permissive · top 5,000 on PyPI
voluptuous-openapiConverts Voluptuous validation schemas into…
permissive · top 15,000 on PyPI
graphene-djangoGraphene-Django bridges Django models and…
permissive · top 5,000 on PyPI