Skip to main content

Adaptive API testing for OpenAPI and GraphQL

Project description

Build Coverage Version Python versions Discord License

Schemathesis

Catch API bugs before your users do.

Schemathesis tests OpenAPI and GraphQL APIs by generating inputs from your schema, adapting to server responses, and chaining operations into realistic workflows.

Schemathesis automatically finding a server error
Finding bugs that manual testing missed

Try it now

# Test a demo API - finds real bugs in 30 seconds
uvx schemathesis run https://example.schemathesis.io/openapi.json

# Test your own API
uvx schemathesis run https://your-api.com/openapi.json

What problems does it solve?

  • 💥 500 errors that crash your API on edge case inputs
  • 📋 Schema violations where your API returns different data than documented
  • 🚪 Validation bypasses where invalid data gets accepted
  • 🔗 Integration failures when responses don't match client expectations
  • 🔄 Stateful bugs where operations work individually but fail in realistic workflows

⚠️ Upgrading from older versions? Check our Migration Guide for key changes.

Installation & Usage

Command Line:

uv pip install schemathesis
schemathesis run https://your-api.com/openapi.json

Python Tests:

import schemathesis

schema = schemathesis.openapi.from_url("https://your-api.com/openapi.json")

@schema.parametrize()
def test_api(case):
    # Tests with random data, edge cases, and invalid inputs
    case.call_and_validate()

# Stateful testing: Tests workflows like: create user -> get user -> delete user
APIWorkflow = schema.as_state_machine()
# Creates a test class for pytest/unittest
TestAPI = APIWorkflow.TestCase

CI/CD:

- uses: schemathesis/action@v3
  with:
    schema: "https://your-api.com/openapi.json"

Who uses it

Used by teams at Spotify, WordPress, JetBrains, Red Hat, and dozens of other companies.

"Schemathesis is the best tool for fuzz testing of REST APIs on the market. We at Red Hat use it for examining our applications in functional and integration testing levels." - Dmitry Misharov, RedHat

See it in action

🔬 Live Benchmarks showing continuous testing results from real-world APIs:

  • Code & API schema coverage achieved
  • Issues found with detailed categorization
  • Performance across different fuzzing strategies

Reporting

  • Allure — Rich visual reports with per-operation results, failure steps, and curl reproduction commands
  • JUnit XML — For GitHub Actions, GitLab CI, Jenkins, and any CI tool that consumes JUnit

Documentation

📚 Documentation with guides, examples, and API reference.

Get Help

Contributing

We welcome contributions! See our contributing guidelines and join discussions in issues or Discord.

Acknowledgements

Schemathesis is built on top of Hypothesis, a powerful property-based testing library for Python.

License

This project is licensed under the terms of the MIT license.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

schemathesis-4.21.3.tar.gz (2.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

schemathesis-4.21.3-py3-none-any.whl (753.0 kB view details)

Uploaded Python 3

File details

Details for the file schemathesis-4.21.3.tar.gz.

File metadata

  • Download URL: schemathesis-4.21.3.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for schemathesis-4.21.3.tar.gz
Algorithm Hash digest
SHA256 4a4866a301b9ebf777105827b02045f9b1b01799fad9d5fd5e22a09dfe901d1c
MD5 e3f35bb1c260d061cea51b194db4be33
BLAKE2b-256 9aefd8715e8be6500199c26c9183c2aee765021f4ab62b9007f90f18653c664e

See more details on using hashes here.

File details

Details for the file schemathesis-4.21.3-py3-none-any.whl.

File metadata

  • Download URL: schemathesis-4.21.3-py3-none-any.whl
  • Upload date:
  • Size: 753.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for schemathesis-4.21.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dfa3d9dfe9e7d6ed0311329ecba65f80e008e44a9e16ca2e18563594da8b0040
MD5 68f9f6d8586d5e86609c4e9634b386f6
BLAKE2b-256 7f2a9202b59605475eec9421480fcfdcb125be4ad48c3dbf042f40a9a0bf196d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page