Skip to content
Latchkey

What Is a Contract Test?

A contract test verifies that the interaction between a service consumer and provider conforms to an agreed contract, such as the request and response shapes of an API. The consumer defines what it expects, and the provider is tested against those expectations. This catches breaking interface changes without spinning up both systems together.

Why it matters

Integration tests that run every service together are slow and flaky, yet teams still need to know that a provider change will not break its consumers. Contract tests give that assurance cheaply by checking each side against the shared contract independently, enabling services to deploy on their own schedules.

Related concepts

  • Consumer-driven contracts are a common style
  • Faster and more isolated than full integration tests
  • Tools include Pact

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →