Two systems can pass their individual tests while failing together. An order service accepts a purchase, the stock service times out and a retry creates a second reservation. Neither a successful API response in isolation nor a screenshot of the happy path proves that the business transaction is dependable.

Integration testing should establish what happens at the boundary between systems. Test the record being exchanged, the identity that connects it, the permissions involved and the recovery behavior when only part of the work succeeds.

Define the contract in business terms

For each integration, identify the source of truth, event or request, required fields and expected state transition. A customer identifier and a customer email address are different contracts. Write down whether missing optional data is acceptable and how an incompatible schema version is rejected.

Use representative examples with deliberate edge cases. Include an inactive customer, a cancelled order, a date near a timezone boundary and an amount with the precision the provider supports. Sanitized fixtures should exercise the rules without copying customer secrets into test logs.

Test more than the successful request

Simulate timeouts, rejected credentials, rate limits and invalid responses. Check the difference between a request that never arrived and one that succeeded but lost its response. Retry behavior must not turn uncertainty into duplicate business activity.

For event delivery, assume duplicates and changed arrival order can occur unless the provider explicitly guarantees otherwise. Store durable references and make repeated processing safe. Stripe's webhook documentation, for example, describes duplicate delivery and ordering considerations that receivers must account for.

Examples of integration failures and the expected controlled response.
ScenarioExpected behaviorEvidence
Duplicate eventNo duplicate business changeOne durable destination reference
Timeout after commitRetry resolves the existing transactionConsistent idempotency record
Invalid fieldReject or quarantine with a reasonActionable validation result
Downstream unavailableRetain work and expose backlogVisible retry or review state

Verify partial failure and reconciliation

Deliberately interrupt a multi-step workflow after one system commits a change. Confirm that operators can identify the unresolved state and recover it through a controlled action. A background job marked complete is not enough if the destination record was never created.

Reconcile the business result across systems. For a shipment, verify order, reservation and dispatch references together. Make rejected items visible with a reason and a responsible owner, rather than hiding them in a log that nobody monitors.

An angled close photograph of a laptop integration test report listing timeout, duplicate delivery and invalid payload cases, plain engineering bench, late afternoon shadows

Make the checks part of release decisions

Keep a small, dependable set of contract and end-to-end tests in the release process. Use provider sandboxes for representative checks, while recognizing that sandbox behavior may not reproduce every production limit or payment outcome.

Assign ownership when an external API changes. Record provider versions, test credentials and fixture assumptions. If a failing test is repeatedly ignored as unreliable, fix its environment or scope; an always-red integration suite provides little protection at launch.

Frequently asked questions

Are mocked integration tests enough?

Mocks are useful for controlled failure cases. Add representative checks against actual test environments so incorrect assumptions about the provider are also detected.

Should every integration test run for every small change?

Run fast contract checks frequently and choose broader end-to-end checks according to the affected paths. Keep a clear release gate for the integrations that complete critical transactions.

Sources and further reading

Make the next step concrete

Discuss your current process, constraints, and intended outcome with GhairMulki. We can help define a focused first release and the checks needed to evaluate it.

Discuss your project