# schemathesis

> Property-based testing framework for Open API and GraphQL based apps

- **URL**: https://www.freshcrate.ai/projects/schemathesis
- **Author**: pypi
- **Category**: Frameworks
- **Latest version**: `v4.21.1` (2026-06-06)
- **License**: Unknown
- **Source**: https://github.com/schemathesis/schemathesis
- **Homepage**: https://pypi.org/project/schemathesis/
- **Language**: Python
- **GitHub**: 3,233 stars, 204 forks
- **Registry**: pypi (`schemathesis`)
- **Tags**: `graphql`, `hypothesis`, `openapi`, `pypi`, `pytest`, `testing`

## Description

<p align="center">
    <a href="https://github.com/schemathesis/schemathesis/actions" target="_blank">
        <img src="https://github.com/schemathesis/schemathesis/actions/workflows/build.yml/badge.svg" alt="Build">
    </a>
    <a href="https://codecov.io/gh/schemathesis/schemathesis/branch/master" target="_blank">
        <img src="https://codecov.io/gh/schemathesis/schemathesis/branch/master/graph/badge.svg" alt="Coverage">
    </a>
    <a href="https://pypi.org/project/schemathesis/" target="_blank">
        <img src="https://img.shields.io/pypi/v/schemathesis.svg" alt="Version">
    </a>
    <a href="https://pypi.org/project/schemathesis/" target="_blank">
        <img src="https://img.shields.io/pypi/pyversions/schemathesis.svg" alt="Python versions">
    </a>
    <a href="https://discord.gg/R9ASRAmHnA" target="_blank">
        <img src="https://img.shields.io/discord/938139740912369755" alt="Discord">
    </a>
    <a href="https://opensource.org/licenses/MIT" target="_blank">
        <img src="https://img.shields.io/pypi/l/schemathesis.svg" alt="License">
    </a>
</p>

## Schemathesis

> **Catch API bugs before your users do.** 

Schemathesis automatically generates thousands of test cases from your OpenAPI or GraphQL schema and finds edge cases that break your API.

<p align="center">
  <img src="https://raw.githubusercontent.com/schemathesis/schemathesis/master/img/demo.gif" alt="Schemathesis automatically finding a server error"/>
  <br>
  <i>Finding bugs that manual testing missed</i>
</p>

## Try it now

```console
# 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](https://github.com/schemathesis/schemathesis/blob/master/MIGRATION.md) for key changes.

# Installation & Usage

**Command Line:**
```console
uv pip install schemathesis
schemathesis run https://your-api.com/openapi.json
```

**Python Tests:**
```python
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:**
```yaml
- uses: schemathesis/action@v3
  with:
    schema: "https://your-api.com/openapi.json"
```

## Who uses it

Used by teams at **[Spotify](https://github.com/backstage/backstage)**, **[WordPress](https://github.com/WordPress/openverse)**, **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](https://workbench.schemathesis.io)** 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](https://schemathesis.readthedocs.io/en/stable/guides/allure/)** — Rich visual reports with per-operation results, failure steps, and curl reproduction commands
- **[JUnit XML](https://schemathesis.readthedocs.io/en/stable/guides/cicd/)** — For GitHub Actions, GitLab CI, Jenkins, and any CI tool that consumes JUnit

## Documentation

📚 **[Documentation](https://schemathesis.readthedocs.io/en/stable/)** with guides, examples, and API reference.

## Get Help

- 💬 [Discord community](https://discord.gg/R9ASRAmHnA)
- 🐛 [GitHub issues](https://github.com/schemathesis/schemathesis/issues)

## Contributing

We welcome contributions! See our [contributing guidelines](CONTRIBUTING.md) and join discussions in [issues](https://github.com/schemathesis/schemathesis/issues) or [Discord](https://discord.gg/R9ASRAmHnA).

## Acknowledgements

Schemathesis is built on top of <a href="https://hypothesis.works/" target="_blank">Hypothesis</a>, a powerful property-based testing library for Python.

## License

This project is licensed under the terms of the [MIT license](https://opensource.org/licenses/MIT).

## Recent releases

| Version | Date | Urgency | Changes |
| --- | --- | --- | --- |
| `v4.21.1` | 2026-06-06 | High | ### :bug: Fixed  - Missing boundary negative in the coverage phase for boolean `exclusiveMinimum` / `exclusiveMaximum`. - `UnicodeEncodeError` when failure or error output contains lone Unicode surrogate characters. [#4229](https://github.com/schemathesis/schemathesis/issues/4229) |
| `v4.21.0` | 2026-05-31 | High | ### :rocket: Added  - Chain GraphQL operations on non-`id` identifiers (`fullPath`, `slug`, ...) in stateful and fuzzing phases.  ### :racing_car: Performance  - Much lower peak memory and faster validation for schemas with very large `maxLength` / `maxItems`. - Cache failed validator builds to avoid recompiling invalid patterns from large `maxLength` / `maxItems` values. - Update `hypothesis-graphql` to `0.13.0` that brings up to 180x performance improvements for deeply nested GraphQL schemas. |
| `v4.20.0` | 2026-05-24 | High | ### :rocket: Added  - Override server variable defaults via `[servers.variables]` in config. [#4166](https://github.com/schemathesis/schemathesis/issues/4166) - Form-encoded payloads for dynamic auth via `payload_content_type`. [#4167](https://github.com/schemathesis/schemathesis/issues/4167)  ### :racing_car: Performance  - ~50% lower coverage-phase wall on definition-heavy schemas. - Cache repeated computations during the coverage phase. - Faster schema bundling for specs with recursive refer |
| `v4.19.0` | 2026-05-19 | High | ### :rocket: Added  - Stateful tests damp reuse of extracted values from unreliable API links. - Reuse response field values across operations without an inferred producer-consumer link. - Persist error-feedback, auth, and 405 discoveries to `.schemathesis/`; probing replays them to skip rediscovery. - Fuzz dictionaries: sample curated values during generation via `[dictionaries.<name>]` and `[generation.dictionaries]`. [#2121](https://github.com/schemathesis/schemathesis/issues/2121) - Overrid |
| `v4.18.5` | 2026-05-13 | High | ### :wrench: Changed  - Render `negative_data_rejection` mutation descriptions cleanly: no trailing `at`, readable original values.  ### :bug: Fixed  - Runtime Error on hook-driven revalidation of OpenAPI 3.1 parameters with `prefixItems`. [#4099](https://github.com/schemathesis/schemathesis/issues/4099) - False positive `negative_data_rejection` when a `before_call` hook reassigns request parameters. [#4101](https://github.com/schemathesis/schemathesis/issues/4101) - Pad negative-mode arrays t |
| `v4.18.0` | 2026-05-08 | High | ### :rocket: Added  #### Resource pool & captured IDs  - Capture identifiers from `{<id>: <object>, ...}` map-by-id GET responses (e.g. team / pod / cluster status maps). - Capture every element of list-shaped responses into the pool, not just the first. - Capture pool entries from custom wrappers, nested envelopes, and multi-array-root GET responses. - Apply pool overlay to foreign-key fields nested inside request body objects.  #### Error feedback (4xx parsers)  - Refine generation from 4xx e |
| `v4.17.0` | 2026-04-29 | High | ### :rocket: Added  - Capture path-parameter values from successful 2xx requests for reuse during fuzzing. - Capture request-body field values from successful 2xx requests for reuse during fuzzing. - Coverage phase records request identifiers into the runtime resource pool for reuse in later phases. - Use identifiers from the runtime resource pool for resource-bound parameters and body fields during the coverage phase. - Use captured body-field values to fill resource-bound fields in the exampl |
| `v4.16.0` | 2026-04-25 | High | ### :rocket: Added  - `schemathesis.openapi.require_security_scheme()` for scoping auth providers to specific OpenAPI security schemes. [#3745](https://github.com/schemathesis/schemathesis/issues/3745)  ### :bug: Fixed  - Query parameters not serialized when `style`/`explode` are omitted from the spec, ignoring OpenAPI 3.0 defaults. - Use the matching registered serializer for multipart fields with `encoding.contentType`. [#3785](https://github.com/schemathesis/schemathesis/issues/3785) - `befo |
| `4.15.2` | 2026-04-21 | Low | Imported from PyPI (4.15.2) |
| `v4.15.2` | 2026-04-14 | Medium | ### :wrench: Changed  - Show compact path for body property violations instead of a verbose chain.  ### :bug: Fixed  - False positive `negative_data_rejection` for integer query parameters with type mutations. [#3712](https://github.com/schemathesis/schemathesis/issues/3712) - False positive `positive_data_acceptance` for arrays with `uniqueItems` and enum items. |

## Citation

- HTML: https://www.freshcrate.ai/projects/schemathesis
- Markdown: https://www.freshcrate.ai/projects/schemathesis.md
- Dependencies JSON: https://www.freshcrate.ai/api/projects/schemathesis/deps

_Generated by freshcrate.ai. Indexes pypi releases for AI-agent ecosystem packages._
