Getting Started
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.
Command-Line Interface
Quick and easy for those who prefer the command line.
Python
Install via pip:
python -m pip install schemathesis
Run tests:
st run --checks all https://example.schemathesis.io/openapi.json
Docker
Pull Docker image:
docker pull schemathesis/schemathesis:stable
Run tests:
docker run schemathesis/schemathesis:stable
run --checks all https://example.schemathesis.io/openapi.json
Python Library
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.
GitHub Integration
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"
For more details, check out our GitHub Action repository.