•
Drizz raises $2.7M in seed funding •
•
Featured on Forbes
•
Drizz raises $2.7M in seed funding •
•
Featured on Forbes

Pact testing verifies that your mobile app and its backend APIs agree on request and response format before either side ships a change. It's consumer-driven contract testing: your mobile app (consumer) defines what it expects from API, and backend (provider) verifies it can deliver.
If your backend team has ever renamed a field, changed a response structure, or removed an endpoint that your mobile app depended on, pact contract testing prevents that from breaking production. The contract catches mismatch in CI before it reaches users.
Contract testing checks that two services agree on how they communicate. Instead of spinning up both services and testing full integration, you test each side independently against a shared contract.
What is contract testing solving? The deployment coupling problem. Without contract testing, you need both mobile app and backend running in same environment to verify they work together. With contract testing, you verify compatibility without a shared test environment.
A pact contract is a JSON file that documents specific request-response pairs. It says: "When mobile app sends GET /orders/123, it expects a 200 response with fields: id, status, eta, and items." The backend verifies it returns exactly that.
Pact testing has two phases: consumer tests and provider verification.
Consumer side (your mobile app or BFF):
Provider side (your backend API):
This flow means mobile team defines expectations and backend team verifies them. Neither side needs other's service running during testing.
In blog: how it works for mobile API integrations, where it fits alongside other testing types and load testing, and when testing contract agreements is overkill for your team. Pact is most popular pact testing tool for this purpose, with support for JavaScript, Java, Python, Go, and Swift. Teams using playwright automation for web testing contract flows can integrate Pact on API layer alongside their existing Playwright test suites.
Not every endpoint needs a pact test. Focus contract tests on APIs where a breaking change would cause most damage.
Start with auth and core transaction endpoints. These are pact contracts that catch bugs your users actually feel.
Here's an example of pact testing for a mobile app that fetches order details. Consumer side in JavaScript:
const { PactV4 } = require('@pact-foundation/pact');
const pact = new PactV4({
consumer: 'MobileApp',
provider: 'OrderService',
});
pact.addInteraction({
states: [{ description: 'order 123 exists' }],
uponReceiving: 'a request for order details',
withRequest: {
method: 'GET',
path: '/api/orders/123',
headers: { Authorization: 'Bearer test-token' },
},
willRespondWith: {
status: 200,
body: {
id: '123',
status: 'shipped',
eta: '2026-06-25T14:00:00Z',
},
},
});
This pact testing example generates a contract file that says: "The mobile app expects GET /api/orders/123 to return id, status, and eta." The backend runs this contract against its real API during provider verification.
Contract testing doesn't replace integration tests or E2E tests. Each catches different bugs.
Contract tests run in seconds and catch format mismatches before you need expensive integration or E2E environments. They complement your other tests. They don't replace them.
The practical testing order for a mobile API change: pact tests verify contract (CI, seconds), integration tests verify data flow (staging, minutes), load tests verify performance (nightly, minutes), E2E tests verify user experience on real devices (nightly, hours).
The Pact Broker (or its managed version, PactFlow) stores contracts and verification results. It's central hub where consumer and provider teams share pacts.
The pact broker serves three functions:
For mobile teams, Pact Broker integrates into your CI pipeline. When mobile app's consumer tests pass, contract publishes to broker. When backend's provider verification passes, result publishes back. Before either side deploys, can-i-deploy checks that versions are compatible.
Pact testing adds setup cost: consumer tests, provider verification, broker infrastructure, CI integration. It's worth it for some teams and overkill for others.
Pact testing is worth it when:
Pact testing is overkill when:
For most mobile teams with separate frontend and backend teams and 10+ API endpoints, pact contract testing pays for itself within first quarter.
DoorDash published their contract testing implementation for their mobile Backend-for-Frontend (BFF). Their setup:
Their key insight: mobile app team owns contract, and BFF team verifies it. This aligns responsibility with team that feels pain when API breaks.
For teams using tools like Playwright for web consumer tests or Drizz for mobile E2E validation, pact testing handles API contract layer while your E2E tool handles user experience layer. Contract testing catches "did response format change?" Drizz catches "does screen still render correctly?" Both layers protect against different failure modes.
Pact testing is consumer-driven contract testing for APIs. The consumer (your mobile app) writes tests that define expected request-response pairs. Pact generates a contract file. The provider (your backend API) verifies it can fulfill contract. Mismatches fail in CI before reaching production.
Pact testing verifies format agreement (request structure, response fields, status codes) without both services running. Integration testing verifies data flow and business logic with both services running in a shared environment. Pact tests are faster and catch contract-level bugs. Integration tests catch logic-level bugs.
A pact broker stores contract files and verification results in a central location. Consumer teams publish contracts after their tests pass. Provider teams pull contracts for verification. The broker also powers can-i-deploy, a CLI tool that checks version compatibility before deployment. PactFlow is managed SaaS version.
Prioritize authentication, core transactions (checkout, payment, booking), and push notification payloads. These are endpoints where a breaking change has most user impact. Low-priority: analytics ingestion and static content endpoints where format changes are rare or have no visible user impact.
Yes. Playwright testing can drive consumer side of pact tests for web consumers. The Afsal Backer guide on Medium shows a playwright test generating pact contracts for GraphQL APIs. For mobile consumers, you'd use Pact's native iOS (Swift) or Android (JVM) libraries instead of Playwright.
Skip pact testing if one small team owns both mobile and backend, your API has fewer than 3 endpoints, changes are rare, or your integration tests already run fast enough to catch contract issues. The setup cost (consumer tests + provider verification + broker) isn't justified for simple, stable APIs owned by a single team.