Testing comparisons

Contract tests vs. integration tests

Distinguish a consumer’s API contract from the behaviour of two running services. Use mismatched fields and wrong-but-valid values to select the right check.

Will a schema-compatible response still break our consuming service?

Use consumer-driven contracts when independently released services need an inexpensive compatibility signal for the interactions they rely on. Use integration tests when deployed components must produce a shared outcome involving state, configuration or sequencing. Both approaches can check semantics if the expectation is expressed explicitly.

Write down what the consumer actually uses

A billing client reads an integer amount in minor currency units. A contract can require the amount field and its type and can verify examples against the provider. A response of 19 instead of 1,900 can satisfy an integer-only rule. Use a documented 19-dollar invoice to make the unit convention observable to both teams.

Contract tests vs. integration tests
Failure modeContract checkIntegration check
Provider drops amount_minorVerify an interaction requiring that named field.Observe the client failing on the provider response.
Integer has the wrong unitUse a constrained example or explicit value rule.Compare the final invoice to a known amount.
Service points at a stale tenantA standalone interaction may still verify.Exercise the deployed configuration with a known invoice.
Provider changes firstVerify contracts of relevant supported consumers.Select a representative cross-service journey for rollout.

Choose one real journey across the boundary

Create that invoice in a disposable provider, read it through the actual client, and compare the displayed amount to the independent invoice total. Record provider and consumer versions. A contract mismatch can often point straight to the incompatible field. A correct response displayed incorrectly sends the investigation into the consumer.

Primary documentation

Your next release starts here

Keep building.
Put testing to work.

Give Cue April your next testing challenge. Let your AI quality lead coordinate the checks, so your team can focus on what comes next.

Create account

Create your account, connect a repository and review your proposed setup before approving a run.