Contract Testing is a technique for testing integrations between services by verifying that both the consumer (client) and provider (API) conform to a shared contract. It catches integration issues early without requiring end-to-end tests.
In distributed systems, services communicate through APIs. When Service A calls Service B, both sides make assumptions: A assumes B will return data in a certain format, and B assumes A will send valid requests. These assumptions form an implicit contract. Contract testing makes this contract explicit and verifiable, ensuring both sides honor their commitments independently.
The key insight is that you don't need both services running simultaneously to verify they'll work together. Instead, each side tests against the contract specification, and if both pass, integration is guaranteed to succeed.