Skip to main content

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

Project description

Build Coverage Version Python versions Discord License

Schemathesis

Schemathesis is an API testing tool that automatically finds crashes and validates spec compliance.

Schemathesis Demo

Finding server crashes in the Demo API.

Highlights

🎯 Catches Hard-to-Find Bugs

  • Uncover hidden crashes and edge cases that manual testing might miss
  • Identify spec violations and ensure your API adheres to its contract

Accelerates Testing Cycles

  • Automatically generate a wide range of test cases based on your API schema
  • Save time by reducing the need for manual test case creation

🧩 Integrates Seamlessly

  • Works with popular API formats such as OpenAPI, GraphQL.
  • Easily integrate into your existing CI/CD workflows.

🔧 Customizable and Extendable

  • Tune the testing process using Python extensions.
  • Adjust the testing flow to suit your needs with rich configuration options.

🐞 Simplifies Debugging

  • Get detailed reports to identify and fix issues quickly.
  • Reproduce failing test cases with cURL commands.

🔬 Proven by Research

  • Validated through academic studies on API testing automation
  • Featured in ICSE 2022 paper on semantics-aware fuzzing
  • Recognized in ACM survey as state-of-the-art RESTful API testing tool

Installation

Use Schemathesis via Docker, or install it from PyPI

# Via Docker.
$ docker pull schemathesis/schemathesis:stable

# With pip.
$ pip install schemathesis

Getting Started

Schemathesis works as a standalone CLI:

docker run schemathesis/schemathesis:stable
   run --checks all https://example.schemathesis.io/openapi.json
# Or when installed with pip
schemathesis run --checks all https://example.schemathesis.io/openapi.json

Or a Python library:

import schemathesis

schema = schemathesis.from_uri("https://example.schemathesis.io/openapi.json")


@schema.parametrize()
def test_api(case):
    case.call_and_validate()

See a complete working example project in the /example directory.

Schemathesis can be easily integrated into your CI/CD pipeline using GitHub Actions. Add this block to your GitHub Actions to run Schemathesis against your API:

api-tests:
  runs-on: ubuntu-latest
  steps:
    - uses: schemathesis/action@v1
      with:
        schema: "https://example.schemathesis.io/openapi.json"
        # OPTIONAL. Add Schemathesis.io token for pull request reports
        token: ${{ secrets.SCHEMATHESIS_TOKEN }}

For more details, check out our GitHub Action repository or see our GitHub Tutorial.

For test reports in your pull requests, install the GitHub app:

image

Schemathesis.io

Schemathesis CLI integrates with Schemathesis.io to enhance bug detection by optimizing test case generation. It also provides a user-friendly UI for viewing and analyzing test results. For a quick setup all-in-one solution, we offer a free tier.

Who's Using Schemathesis?

Schemathesis is used by a number of projects and companies, including direct usage or integration into other tools:

Testimonials

"The world needs modern, spec-based API tests, so we can deliver APIs as-designed. Schemathesis is the right tool for that job."

Emmanuel Paraskakis - Level 250

"Schemathesis is the only sane way to thoroughly test an API."

Zdenek Nemec - superface.ai

"The tool is absolutely amazing as it can do the negative scenario testing instead of me and much faster! Before I was doing the same tests in Postman client. But it's much slower and brings maintenance burden."

Luděk Nový - JetBrains

"Schemathesis is the best tool for fuzz testing of REST API on the market. We are at Red Hat use it for examining our applications in functional and integrations testing levels."

Dmitry Misharov - RedHat

"There are different levels of usability and documentation quality among these tools which have been reported, where Schemathesis clearly stands out among the most user-friendly and industry-strength tools."

Testing RESTful APIs: A Survey - a research paper by Golmohammadi, at al

Contributing

We welcome contributions in code and are especially interested in learning about your use cases. Your input is essential for improving Schemathesis and directly influences future updates.

How to Contribute

  1. Discuss ideas and questions through GitHub issues or on our Discord channel.
  2. For code contributions, see our contributing guidelines.
  3. Share your experience and thoughts using this feedback form.

Why Your Input Matters

  • Enables us to develop useful features and fix bugs faster
  • Improves our test suite and documentation

Thank you for contributing to making Schemathesis better! 👍

Commercial support

If you're a large enterprise or startup seeking specialized assistance, we offer commercial support to help you integrate Schemathesis effectively into your workflows. This includes:

  • Quicker response time for your queries.
  • Direct consultation to work closely with your API specification, optimizing the Schemathesis setup for your specific needs.

To discuss a custom support arrangement that best suits your organization, please contact our support team at support@schemathesis.io.

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-3.38.7.tar.gz (57.9 MB view details)

Uploaded Source

Built Distribution

schemathesis-3.38.7-py3-none-any.whl (327.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: schemathesis-3.38.7.tar.gz
  • Upload date:
  • Size: 57.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for schemathesis-3.38.7.tar.gz
Algorithm Hash digest
SHA256 09150618516b865772e1c343234abcd785621a651c487c381f2fdf5a38b2c39a
MD5 b6f9ec2a01d15c1cd8f2aee1b23b83b2
BLAKE2b-256 f0b713b4417bba802dd4615de41e0acfe87191bfce7e97f6c27c82b666f27d18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for schemathesis-3.38.7-py3-none-any.whl
Algorithm Hash digest
SHA256 9ba22c115459c02a2d4c817f6053d9eda1ccdd3b656a0c62e9e6c255e020605b
MD5 133c993dc492c0f2bf7afb53bf8e3083
BLAKE2b-256 f3d2810b2794dc9a2c584762ac9e563ac3dbf6ebf66d9f418d7db6484592ab7a

See more details on using hashes here.

Supported by

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