How-to guide

How to verify a consumer-driven contract

How do I know that a provider change is compatible with a consumer?

Capture the interaction the real consumer depends on and verify it against the provider version you plan to deploy. Use a known provider state and retain both version identities with the verification result.

Check both sides of the interaction

A contract is strongest when the consumer test exercises its real client code and the provider verification exercises its real interface.

  1. Exercise the consumer with a representative response. Describe the request and the status, fields or values its behaviour actually requires.
  2. Publish that interaction with the consumer version. Set up a reproducible provider state, then run the interaction against the candidate provider.
  3. Compare the candidate with supported consumer versions. Record mismatches and rerun after either side intentionally changes the contract.

Worked example

A collection screen needs its time slot

The collection app reads a slot’s start time as an ISO timestamp. A provider returns the slot with a successful status but changes the field to a display label. Provider verification against the consumer’s expected timestamp format exposes the incompatible change before the two versions ship together.

Try it on your pull request

Choose a change in your repository and tell Cue April what should happen. Review the proposed checks before they run.

Try Cue April on your repository