Contract testing

Contract testing that answers one question: can I deploy?

Capture the contract between a consumer and a provider, publish it to the broker, verify both sides, and gate your deploy on the result. No more finding out in production that a provider dropped a field a consumer still needs.

Inizia Get the desktop app

Consumer-driven contracts

A consumer records exactly what it needs from a provider: these fields, these types, this status. That expectation becomes the contract, so the provider is tested against real usage rather than a document that drifted months ago.

Contracts are Pact compatible, so they fit the tooling and conventions your teams may already use.

  • Contracts generated from real consumer expectations
  • Pact compatible format
  • One source of truth both teams agree on
A consumer contract: the fields and types a client depends on. · click to enlarge

A broker for your contracts

Publish contracts to the built-in broker and every team sees the same versions, tagged by branch and environment. The broker tracks which consumer version expects what, and which provider version satisfies it.

Browse services, contracts, and their relationships from the Cloud UI instead of passing pact files around by hand.

  • Publish and retrieve contracts by version
  • Tag by branch and environment
  • Browse services and their contracts in the UI
The broker: services, versions, and who depends on whom. · click to enlarge

Provider verification

Verify a provider against every contract its consumers published. The provider replays the recorded expectations and the broker records the result against that provider version, so you always know the real compatibility state.

Verification runs in CI, so a provider change that would break a consumer fails the provider build, not the consumer in production.

  • Replay consumer expectations against the provider
  • Results recorded per provider version
  • Runs in CI on every change
Verification results recorded against a provider version. · click to enlarge

Compatibility matrix

The matrix shows, for every consumer version and provider version, whether they are verified to work together. It is the difference between hoping a pair is compatible and knowing it.

When you ask whether a version can go to an environment, the matrix is the evidence behind the answer.

  • Every consumer and provider version pair
  • Verified, unverified, or failing at a glance
  • The evidence behind every deploy decision
The matrix: which versions are proven to work together. · click to enlarge

deploy-check: the safe-to-ship gate

Before a release, deploy-check asks the broker whether the version you are about to deploy is compatible with everything already running in the target environment. A clear pass or fail, wired into your pipeline as a gate.

If a consumer in production still needs a field this provider version drops, the gate fails and the deploy stops, with the reason spelled out.

  • Checks a version against a whole environment
  • Blocks unsafe deploys in CI
  • Explains exactly which pair is incompatible
deploy-check: a clear pass or fail wired into the pipeline. · click to enlarge

Webhooks and CI

Trigger provider verification automatically when a consumer publishes a new contract, and feed results back to your pipeline with webhooks. The loop stays closed without anyone remembering to run a step.

  • Verify automatically on new contracts
  • Webhooks into your CI and chat
  • No manual step to forget
Webhooks kick off verification the moment a contract changes. · click to enlarge

How contract testing flows

  1. 1

    Consumer records a contract

    The consumer test captures exactly what it needs and publishes the contract to the broker, tagged with its version.

  2. 2

    Provider verifies

    The provider replays those expectations in CI, and the broker records whether that provider version satisfies them.

  3. 3

    Matrix stays current

    Every verified pair updates the compatibility matrix, so the state of the world is always visible.

  4. 4

    deploy-check gates the release

    Before shipping, the gate asks the broker if this version is safe for the target environment, and stops the deploy if it is not.

Frequently asked questions

Is this compatible with Pact?

Yes. Contracts use the Pact compatible format, so they fit existing conventions and tooling while the broker, matrix, and deploy gate live in API Spector.

What does deploy-check actually check?

It asks the broker whether the version you want to deploy is verified compatible with every version already running in the target environment. If any required consumer would break, it fails and names the pair.

Do I need a separate broker service?

No. The broker is built in. You publish contracts to it, verify against it, and read the matrix from the same Cloud UI.

Where does verification run?

In your CI, triggered on contract changes via webhooks or on your provider build. Results are recorded per version so the matrix and the deploy gate always reflect reality.

Explore more

Testing

API testing →

Mocking

API mocking →

Monitoring

API monitoring →

Inizia gratis. Paga quando ti fa risparmiare tempo.

The desktop app is free and open source. Add the cloud when you want hosted mocks, monitoring, and a shared broker.