Skip to content

CICD-328 · API contract testing ​

Encyclopedia · Advanced networking and API testing · All snippets

Previous · CICD-327 · Next · CICD-329

1. Where it fits ​

  • Placement CI run step or authorized lab terminal.
  • Prerequisites authorized test service, known endpoint or local fixture and the named test CLI.
  • Platforms local-linux, github-actions, gitea-actions.
  • Parameters API_BASE_URL.

2. Copy the snippet ​

bash
schemathesis run openapi.yaml --url "${API_BASE_URL:?}"

3. How it works ​

The CLI derives API requests from the supplied schema and runs the assertions against the configured fixture endpoint.

4. Verify the result ​

Use a disposable API with synthetic data and allowlisted operations. Contract generation may execute write methods declared in the schema.

Validation syntax-validated (Bash parse). Status definitions.