# Mock services vs staging integrations

> Compare a deterministic stub with a real staging integration. Exercise a delayed callback and inspect the provider version and stored state on both sides.

Source: https://cueapril.com/compare/mock-services-vs-staging-integrations
Updated: 2026-12-01
Index: https://cueapril.com/llms.txt

## Which dependency failures can a stub reproduce, and which need a real test environment?

Mock a dependency when you need to reproduce rare delays, error responses or retries on demand. Use a staging integration to establish that real components can authenticate, exchange the intended messages and store compatible state. Keep a few real-boundary checks to expose assumptions that a stub can accidentally make permanent.

Choose service stubs or staging integrations. Reproduce a delayed callback, then verify the provider version and the state each side actually stored.

Cue April editorial assessment. The sources identify documented capabilities. Suggested pilot checks are evaluation criteria.

## Make the delayed callback repeatable

Give a disposable order a unique reference and configure the stub to delay its callback until after the application’s timeout. Assert that the order is pending, then completes exactly once when the callback arrives. A configurable stub gives the team control over the timing and payload. Record both so the test can explain which state changed first.

Mock services vs. staging integrations

| Failure of interest | Controlled stub | Staging integration |
| --- | --- | --- |
| Callback arrives late | Set the precise delay and assert the interim state. | Observe timing under the available test environment. |
| Callback repeats | Deliver the same event twice with one ID. | Confirm how the real provider identifies redelivery. |
| Provider changes a status field | A hand-authored fixture may keep the old value. | Compare the real response with the consumer contract. |
| Test data cleanup | Reset the stub and local records each run. | Use supported test accounts and record cleanup ownership. |

## Detect a trustworthy-looking stale stub

Run the actual staging provider’s supported flow on a test account and inspect the returned field names, version and final status on both sides. A fixture can accurately model last month’s payload while missing a changed status today. Update the fixture against the provider contract and keep real credentials out of recorded examples.

## Primary documentation

- [WireMock response delays and fault simulation](https://wiremock.org/docs/simulating-faults/)
- [Pact consumer-driven contract testing](https://docs.pact.io/)

By Cue April. Updated 2026-12-01.

## Related

- [Testing comparisons](https://cueapril.com/compare): Compare testing tools and methods against a release decision. Inspect the required evidence, maintenance work and checks each approach can provide.
- [API testing](https://cueapril.com/testing/api-testing): Automated API testing with approved assertions and schema campaigns. Inspect response checks, failed cases and the exact scope behind each result.
- [Testing comparisons](https://cueapril.com/compare/contract-vs-integration-testing): Compare a consumer contract with the behaviour of running services. Use mismatched fields and valid but incorrect values to decide what to test.
