The integration test problem
Spinning up every service together to test interactions is slow, flaky, and hard to maintain. Yet you still must catch when a provider breaks a consumer.
What a contract is
A contract captures the expectations between a consumer and a provider: the requests the consumer sends and the responses it expects.
Consumer driven contracts
In the common style, the consumer defines its expectations and shares them. The provider then runs the contract against itself in its own pipeline.
- If the provider still satisfies the contract, the integration is safe.
- If a provider change breaks the contract, its build fails before deploy.
Why it scales
Each side tests against the shared contract independently, with no need to run everything together. This catches breaking changes early while keeping tests fast and isolated.
Key idea
Contract testing verifies each provider against shared consumer expectations independently, catching breaking API changes without slow full integration runs.