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

  1. Install via pip: python -m pip install schemathesis

  2. Run tests:

st run --checks all https://example.schemathesis.io/openapi.json

Docker

  1. Pull Docker image: docker pull schemathesis/schemathesis:stable

  2. 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.

  1. Install via pip: python -m pip install schemathesis

  2. 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.