Supercharge your API testing, catch bugs, and ensure compliance
Schemathesis: Supercharge your API testing, catch bugs, and ensure compliance
Documentation: https://schemathesis.readthedocs.io/en/stable/
Chat: https://discord.gg/R9ASRAmHnA
Schemathesis is a tool that levels-up your API testing by automating the process of finding crashes, uncovering bugs, and validating spec compliance. With Schemathesis, you can:
🎯 Catch Hard-to-Find Bugs
⚡ Accelerate Testing Cycles
🧩 Integrate Seamlessly
🔧 Customize and Extend
📊 Gain Valuable Insights
With a summary right in your PRs:
Choose from multiple ways to start testing your API with Schemathesis.
💡 Your API schema can be either a URL or a local path to a JSON/YAML file.
Quick and easy for those who prefer the command line.
Python
python -m pip install schemathesis
st run --checks all https://example.schemathesis.io/openapi.json
Docker
docker pull schemathesis/schemathesis:stable
docker run schemathesis/schemathesis:stable
run --checks all https://example.schemathesis.io/openapi.json
For more control and customization, integrate Schemathesis into your Python codebase.
python -m pip install schemathesis
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.
GitHub Actions
Run Schemathesis tests as a part of your CI/CD pipeline.
Add this YAML configuration to your GitHub Actions:
api-tests:
runs-on: ubuntu-22.04
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.
💡 See our GitHub Tutorial for a step-by-step guidance.
GitHub App
Receive automatic comments in your pull requests and updates on GitHub checks status. Requires usage of our SaaS platform.
Schemathesis CLI integrates with Schemathesis.io to enhance bug detection by optimizing test case generation for efficiency and realism. It leverages various techniques to infer appropriate data generation strategies, provide support for uncommon media types, and adjust schemas for faster data generation. The integration also detects the web server being used to generate more targeted test data.
Schemathesis.io offers a user-friendly UI that simplifies viewing and analyzing test results. If you prefer an all-in-one solution with quick setup, we have a free tier available.
Here’s a simplified overview of how Schemathesis operates:
Our study, presented at the 44th International Conference on Software Engineering, highlighted Schemathesis's performance:
Defect Detection: identified a total of 755 bugs in 16 services, finding between 1.4× to 4.5× more defects than the second-best tool in each case.
High Reliability: consistently operates seamlessly on any project, ensuring unwavering stability and reliability.
Explore the full paper at https://ieeexplore.ieee.org/document/9793781 or pre-print at https://arxiv.org/abs/2112.10328
"The world needs modern, spec-based API tests, so we can deliver APIs as-designed. Schemathesis is the right tool for that job."
"Schemathesis is the only sane way to thoroughly test an API."
"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."
"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."
"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."
We welcome contributions in code and are especially interested in learning about your use cases. Understanding how you use Schemathesis helps us extend its capabilities to better meet your needs.
Feel free to discuss ideas and questions through GitHub issues or on our Discord channel. For more details on how to contribute, see our contributing guidelines.
Your feedback is essential for improving Schemathesis. By sharing your thoughts, you help us develop features that meet your needs and expedite bug fixes.
Thank you for contributing to making Schemathesis better! 👍
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:
To discuss a custom support arrangement that best suits your organization, please contact our support team at [email protected].
Schemathesis is built on top of Hypothesis, a powerful property-based testing library for Python.
Schemathesis is used by a number of project and companies, including direct usage or integration into other tools:
This project is licensed under the terms of the MIT license.