Choose from multiple ways to start testing your API with Schemathesis.
Note
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.
- Install via pip:
python -m pip install schemathesis
- Run tests:
st run --checks all https://example.schemathesis.io/openapi.json
- Pull Docker image:
docker pull schemathesis/schemathesis:stable
- Run tests:
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.
- Install via pip:
python -m pip install schemathesis
- Add to your tests:
import schemathesis
schema = schemathesis.from_uri("https://example.schemathesis.io/openapi.json")
@schema.parametrize()
def test_api(case):
case.call_and_validate()
Note
See a complete working example project in the /example directory.
Note
💡 See our GitHub Tutorial for a step-by-step guidance.
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.
Receive automatic comments in your pull requests and updates on GitHub checks status. Requires usage of our SaaS platform.
- Install the GitHub app.
- Enable in your repository settings.
If you prefer an all-in-one solution with quick setup, we have a free tier available.