> ## Documentation Index
> Fetch the complete documentation index at: https://qodex.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Contract testing

> A plain definition of API contract testing, why it matters, and how Qodex's spec-based API testing catches contract breaks.

# Contract testing

Contract testing checks that two services agree on the shape of the messages they exchange. That shared shape, the endpoints, the request and response fields, the data types, and the status codes, is the "contract." Contract testing confirms each side still honors it, so a change in one service does not silently break the other.

It is most useful between a consumer (the caller) and a provider (the API). Consumer-driven tools such as Pact record what the consumer expects and replay it against the provider on every change.

## Why it matters

Integration bugs often come from a quiet contract break: a field gets renamed, a type changes from string to number, a `200` becomes a `202`, or a required field disappears. The caller keeps compiling but fails at runtime. Contract testing catches these before they ship.

## How Qodex relates to contract testing

Qodex imports your OpenAPI or Swagger spec and can validate live API responses against that schema and against your plain-English assertions. A renamed field, a wrong type, a missing required property, or an unexpected status code shows up as a failing scenario, which catches many of the same breaks contract testing targets.

Qodex is not a dedicated consumer-driven contract framework like Pact; it does not broker a signed contract between two teams. It verifies that your real API still matches its declared spec and expected behavior, continuously, on every pull request and deploy.

## Related

<CardGroup cols={2}>
  <Card title="API testing" icon="plug" href="/docs/api-testing">
    Import a spec and author scenarios against real endpoints.
  </Card>

  <Card title="Import an OpenAPI spec" icon="file-code" href="/docs/api-testing-openapi-import">
    Parse OpenAPI or Swagger into the endpoint catalog.
  </Card>

  <Card title="Test rules in plain English" icon="pencil" href="/docs/api-testing-test-rules">
    Write response assertions in natural language.
  </Card>

  <Card title="Auto-verification on save" icon="check-check" href="/docs/api-testing-auto-verification">
    Run a new API scenario against the target immediately.
  </Card>
</CardGroup>
