What is Data Contract Testing

Definition

Data contract testing is the practice of automatically verifying that data produced by a source conforms to an agreed contract's schema, types, and rules, typically within CI/CD, so that contract-violating changes are caught before they reach and break downstream consumers.
« Back to Glossary Index
  • Catches contract violations in CI before bad changes reach consumers
  • Automates enforcement of agreed schema and quality rules at the producer
  • Prevents the breaking changes that cause downstream pipeline failures
  • Builds confidence that producer changes remain compatible by design

Real World Example

When an engineer modifies the orders service, a contract test in the CI pipeline checks the emitted event against the registered data contract and fails the build because a required field was renamed, stopping the break early.

FAQs

What does data contract testing verify?

It verifies that produced data matches the agreed contract, checking schema, types, required fields, and quality rules.

Where does contract testing run?

Typically in CI/CD pipelines on producer changes, and sometimes at runtime against incoming data.

How does it differ from data validation?

Validation checks data against rules generally, while contract testing specifically enforces the agreed producer-consumer contract, often pre-deployment.

Hello popup window