What problem does consumer-driven contract testing (e.g. Pact) solve?
Options
- It runs load tests against the deployed service
- It checks providers still meet their consumers' needs (Correct option)
- It compares UI screenshots to find the changes
- It tests the database migrations of a service
Answer
Verifying that a provider API still satisfies what its consumers expect, without running full end-to-end environments
Why
Service A (consumer) calls service B (provider). If B renames a field, A breaks, and maybe nobody notices until production.
With contract tests, A records exactly which requests it sends and which response fields it needs (the contract). B's CI verifies that it still satisfies every consumer's contract.
It catches breaking API changes early without a full environment of all services.
Remember
Contract tests = provider checks it still meets consumers' expectations.