mediumConceptDesignScenarioMidSenior
Two teams own two services that talk to each other. How do you stop one breaking the other without running both together in a shared environment?
4 min readUpdated 2026-08-15
Answer
Short answer
Contract testing has each side verify itself against a shared description of the interaction, so consumer expectations are checked against the provider's real behaviour without the two ever running together.
Was this answer helpful?
Likely follow-ups
- A provider adds a required request field. Which pipeline goes red, and when?
- How is this different from publishing an OpenAPI spec and validating against it?
- What does contract testing not catch that you still need an end-to-end test for?
- Who owns the contract, and what happens when a consumer wants a field the provider will not add?
Related questions
- Your consumer-driven contract test passes in CI, but production rejects a request because a supposedly optional field is missing. What did the contract testing actually miss?hardAlso on contract-testing and api-testing4 min
- You own the API test suite for a service from scratch. How do you structure it, and what do you mock?hardAlso on api-testing and contract-testing8 min
- A teammate says a saga can just roll everything back if step four fails. What is wrong with that, and what would you tell them to build instead?hardAlso on microservices5 min
- Your API suite runs on every commit against a shared database. How do you keep the tests from corrupting each other's data?hardAlso on api-testing6 min