Contract Testing
ELI5 — The Vibe Check
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 plug fits the socket before running electricity. If the contract breaks, you know before production.
Real Talk
A testing approach that verifies the interaction between services by testing against a shared contract (expected request/response format). Consumer-driven contract tests let the consumer define expectations, which the provider then verifies against. This catches integration issues without requiring a running integrated environment.
When You'll Hear This
"Contract tests caught the breaking change in the user API before it reached production." / "We run contract tests in CI so the backend team can't break the frontend's API expectations."
Related Terms
API Testing
API testing is checking that your backend endpoints work correctly — sending requests with different data and making sure you get the right responses, stat...
Consumer-Driven Contracts
Consumer-Driven Contracts flip API testing upside down.
Integration Test
If a unit test checks one LEGO brick, an integration test checks that two bricks actually snap together correctly.
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.