The Integration Gap
Unit tests check one service in isolation, but they miss mismatches between a service and its callers. Full end to end tests catch those but are slow and flaky. Contract testing fills the gap by verifying that a provider honors the exact shape consumers depend on.
Consumer Driven Contracts
In the common consumer driven style, each consumer records the requests it makes and the responses it expects. These expectations form a contract. The provider then runs the contract against its real implementation in its own pipeline.
What It Catches
- A provider removing or renaming a field a consumer reads.
- A changed status code or content type.
- A broken assumption before it reaches production.
Why It Scales
Contract tests run fast and per service, so you do not need a full environment with every dependency up. A broker stores contracts and shows which provider versions are safe to deploy against which consumers.
Key idea
Contract testing verifies a provider against the exact expectations its consumers record, catching integration breaks fast and per service without a full end to end environment.