Techment — Site Header

What is Contract Testing

Definition

Contract testing verifies that two services communicating with each other agree on a shared interface, or contract, by independently checking that the provider meets what the consumer expects, catching integration breakages without running both services together.
« Back to Glossary Index
  • Catches breaking interface changes between services without full integration runs
  • Lets teams develop and deploy services independently with confidence
  • Pinpoints which side broke a contract, speeding fixes
  • Runs fast in each service’s own pipeline rather than in a shared environment

Real World Example

A consumer service defines the response it expects from a provider API as a contract; the provider's pipeline verifies it still satisfies that contract, so a breaking field rename is caught before either side deploys.

FAQs

What is a contract in contract testing?

It is the agreed expectation of requests and responses between a consumer service and a provider service.

How does contract testing differ from integration testing?

Contract testing verifies each side against the shared contract independently, avoiding the need to run all services together as integration testing does.

What is consumer-driven contract testing?

An approach where consumers define their expectations, and providers verify they meet every consumer's contract.

Hello popup window