What is contract testing?
Contract testing checks that an API provider and its consumers still agree on the shape of requests and responses.
A contract describes what a consumer sends and what it expects back. Contract tests run on both sides: the consumer’s expectations are checked against the provider, so a breaking change fails in the provider’s pipeline before it is deployed.
It is especially useful with many services or external clients, where running full end-to-end environments for every change is slow and expensive.
Example
The mobile app expects an order response to include estimatedDelivery. A backend change renames it to deliveryEta, and the contract test fails in the backend pull request.
Best practices
- Define contracts from real consumer usage
- Run provider verification on every backend change
- Version contracts alongside the code
- Treat a contract failure as a breaking change
Ship without fear.
Start testing free in minutes, or let a QAShift engineer deliver your first morning report within 5 days.