Last updated:
Stanislav Anisimov
Contract testing
Click to expand / collapse

When working with APIs between teams or external partners, it is especially important that the format of requests and responses remain predictable. Contract testing allows you to verify that both parties - the client and the server - agree to the exchange structure and do not violate it during updates.

We implement contract tests that automatically check API compliance with documentation or consumer expectations - before going into production.


What is an API contract

A contract is an agreement that defines:
  • which fields contain the request and response
  • what data formats are allowed
  • which status codes are returned
  • what mandatory parameters are required

Contract violation = potential customer or service failure.


How does it work

PartyWhat is being tested
Provider (API)API must meet client expectations for response structure
Customer (consumer)The client is waiting for a certain scheme - the test checks that it is met
BidirectionalTwo-way testing: both client and server agree to contract

Tools used: Pact, Spring Cloud Contract, Dredd, Postman Contract Tests.


Benefits of contract testing

Identification of non-conformities prior to depletion

Protect against "silent" changes that break customers

Safely update API versions

Increase trust between development teams

Logging contract change history


How we implement

Define OpenAPI/Pact contracts

CI integration with automatic test runs at each commit

Visualization and history of contract changes

Staging/production

Publishing Contracts for External Integrators


Where especially important

Shared responsibility microservices

Platforms with external B2B integrations

Working on APIs with Multiple Independent Commands

Critical systems where error is unacceptable (finance, public services)


Contract testing is a reliable bridge between the server and the client. We will help you build a process in which no update disrupts integration and does not bring unexpected bugs.

Popular topics


Main topics