Consumer-Driven Contracts
ELI5 — The Vibe Check
Consumer-Driven Contracts flip API testing upside down. Instead of the API defining what it provides and consumers adapting, consumers define what they NEED and the API promises to deliver it. If the API changes something a consumer depends on, the test fails. The consumer drives the contract.
Real Talk
Consumer-driven contract testing is a pattern where API consumers define their expected interactions, and these expectations are verified against the provider. Unlike provider-driven schemas, this ensures providers only break changes that no consumer depends on. Implemented via Pact, Spring Cloud Contract, or custom verification.
When You'll Hear This
"Consumer-driven contracts let us safely remove unused API fields." / "Every consumer publishes their contract — the API CI pipeline verifies them all."
Related Terms
API Testing Patterns
API Testing Patterns are strategies for testing your APIs thoroughly: happy path, error responses, validation, auth, pagination, rate limiting.
Contract Testing
Contract testing verifies that two services agree on their API contract — the request format, response shape, and status codes. It's like checking that the
Pact
Pact is contract testing for APIs. The consumer (frontend) writes what it expects from the provider (API), and Pact verifies both sides honor the contract.