# Contract testing vs integration testing

> Compare a consumer contract with the behaviour of running services. Use mismatched fields and valid but incorrect values to decide what to test.

Source: https://cueapril.com/compare/contract-vs-integration-testing
Updated: 2026-12-01
Index: https://cueapril.com/llms.txt

## 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.

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.

Cue April editorial assessment. The sources identify documented capabilities. Suggested pilot checks are evaluation criteria.

## 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 mode | Contract check | Integration check |
| --- | --- | --- |
| Provider drops amount_minor | Verify an interaction requiring that named field. | Observe the client failing on the provider response. |
| Integer has the wrong unit | Use a constrained example or explicit value rule. | Compare the final invoice to a known amount. |
| Service points at a stale tenant | A standalone interaction may still verify. | Exercise the deployed configuration with a known invoice. |
| Provider changes first | Verify 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

- [Pact consumer-driven contract testing](https://docs.pact.io/)
- [OpenAPI Specification](https://spec.openapis.org/oas/latest.html)

By Cue April. Updated 2026-12-01.

## Related

- [Testing comparisons](https://cueapril.com/compare): Compare testing tools and methods against a release decision. Inspect the required evidence, maintenance work and checks each approach can provide.
- [API testing](https://cueapril.com/testing/api-testing): Automated API testing with approved assertions and schema campaigns. Inspect response checks, failed cases and the exact scope behind each result.
- [Testing comparisons](https://cueapril.com/compare/unit-vs-integration-testing): Trace a pricing change across a calculation and its database boundary. Choose the smallest unit or integration test that reproduces the suspected failure.
