QAAnywhere

Remote QA & testing jobs, worldwide.

Guides

Contract testing explained: catching broken integrations early

By Denis Bojkovski, Test Automation Architect · Published November 25, 2026

The gap between two green pipelines

The billing service renames customerId to customer_id. Its own tests pass, because they were updated. The invoices service's tests pass, because they use a mock with the old name. The fault appears in a shared environment, or in production. Contract tests exist to catch precisely this.

None of the 86 full descriptions on QAAnywhere on 25 November 2026 named Pact or contract testing. It is not a keyword that will get you an interview; it is an idea that helps you answer questions about testing microservices well.

What a contract is

A contract records what one consumer actually needs from one provider: the request it sends, and the parts of the response it reads. In consumer-driven testing:

  1. The consumer's unit test runs against a stub and records its expectations.
  2. The recording is published as a contract.
  3. The provider replays each request against its real code and checks the response.
  4. Before deploying, each side asks whether the version it would meet has been verified.

Two important consequences follow. The provider learns which fields are used, so it may change the others freely. And neither side needs the other to be running.

How it differs from its neighbours

Check Finds Misses
Unit test with a mock Faults in your code The mock being wrong
Schema validation Wrong types, missing fields Whether anyone needs them
Contract test Broken expectations between two versions Business logic across services
End-to-end test Whole-journey faults Says little about where

Match types, not values

A contract should say "total is a number", not "total is 24.00". If the provider must hold exact data, the contract becomes a copy of its tests and breaks for uninteresting reasons. Exact values are right only where the consumer branches on them, such as a status of cancelled.

Provider states

Some responses need a situation: "order 42 exists and is paid". The contract names the state; the provider's test sets it up. Keep the names in business language and few in number. A provider with sixty states has usually been given functional tests in disguise.

Contracts for messages

Services that exchange messages have the same problem without HTTP. The consumer states the message shape it can handle; the producer proves that its code generates such a message. This is often the most valuable use, because there is no response to notice a failure: a bad message simply sits in a queue.

When it is not worth it

  • One team owns both sides and deploys them together.
  • The provider is a public API you cannot run checks inside. Test your adapter against recorded responses, and run a small scheduled check against the real service.
  • The provider has hundreds of unknown consumers. Published schemas with compatibility checks suit better.
  • The teams will not act on a failed verification. The tool cannot fix that.

Introducing it

Pick one integration that broke recently. Write one contract for the interaction that failed, verify it in the provider's pipeline, and show the team that reintroducing the fault stops the build. Add the deployment check only after both sides trust the result. A tester is well placed to lead this, since it needs knowledge of both teams.

Explaining it in an interview

Use the renamed field story. Say what each kind of test would have done, and where you would still keep a few end-to-end tests. Then mention the limits. Understanding when a technique does not apply shows more experience than enthusiasm for it. Related: the test pyramid in practice.

Open remote QA roles

  1. QA Engineer (Manual Testing)Velixo · Poland
  2. Quality Analyst (healthcare programs)General Dynamics Information Technology · United States
  3. Marathi Audio Transcription QAWelocalize · India
  4. Bengali Audio Transcription QAWelocalize · India
  5. Quality Analyst (healthcare programs)Gdit · Any Location / Remote

More guides