Course outline

API Testing / Advanced: versioned evidence and review / Lesson 21

Verify durable effects after an uncertain timeout

Test lost responses, retry keys and final state using a bounded synthetic API scenario.

About 4 min readContent reviewed
On this page

Lesson goals

  • Distinguish a client timeout from server outcome.
  • Test identical and changed requests under an agreed key policy.
  • Inspect durable effects and record uncertainty.

Model an uncertain outcome

A client timeout says that the client did not receive a timely response; it does not establish whether the server performed the operation. An API test must distinguish the observed timeout from the server’s durable state. In this fictional isolated lab, a synthetic enrollment request may complete before its response is lost. Define the retry policy, key scope and expected side effects with the service owner before testing. Never use real payments or production accounts as disposable fixtures.

Define the retry and key contract

For the lab policy, a repeated identical request with the same key should not create a second enrollment, while a changed request with that key receives the documented conflict or rejection. The first table shows the uncertain client observation and possible server state; it is not an execution result. Record how long keys remain valid and which principal and operation scope them. Different APIs can specify different semantics, so do not treat the example policy as a universal HTTP guarantee.

text Synthetic retry evidence
Moment | Client observation | Possible server state
first request | timeout | outcome unknown
retry | response | inspect durable effect

The table describes the lab policy and uncertain observation, not an executed request.

Control the lost-response scenario

In a controlled service double or authorized isolated instance, arrange for the first request to be processed and its response to be withheld from the synthetic client. Preserve a safe request identifier and key reference without logging credentials. Repeat the identical request within the documented scope. The test harness must establish that the first operation reached the intended processing point; a network timeout introduced before the request arrives tests a different scenario. Keep the two cases separate.

Inspect durable effects and conflicts

Inspect the durable records and any queued side effects after both requests, not only the response returned by the retry. Under the lab policy there should be one intended enrollment. Next repeat with a changed request and the same key, and check the documented conflict behavior and unchanged state. The second table summarizes expected cases rather than actual results. If a response is still unavailable, record the outcome as unknown until a safe observation resolves it.

text Synthetic retry evidence
Case | Lab expectation
same key, same request | one effect under agreed policy
same key, changed request | documented conflict or rejection

The table describes the lab policy and uncertain observation, not an executed request.

Verify the evidence and limits

After a repair, rerun the lost-response scenario, an ordinary success and the changed-request case with fresh synthetic identities. Record the service artifact, contract version, timing assumptions and all observed state. Verify the client’s reconciliation behavior without assuming that retries are always safe or unlimited. A successful controlled test supports the key policy for those conditions; it does not establish correctness across every storage failure, expiration boundary or concurrent request schedule.

Common errors and fixes

Assuming a timeout means the server did nothing

Why it happens
The response can be lost after processing.
How to fix it
Inspect the durable state through a safe observation path.
Prevent it next time
Model uncertain outcomes in retry tests.

Checking only the retry response

Why it happens
The first and second requests may create duplicate effects.
How to fix it
Count and inspect the resulting synthetic records.
Prevent it next time
Assert state as well as response behavior.

Assuming one key policy applies to every API

Why it happens
Scope and conflict behavior are contract-specific.
How to fix it
Use the documented service policy.
Prevent it next time
Record key scope, lifetime and expected conflict behavior.

2 practice exercises

1. The first response is lost after processing and a retry returns success. What must be checked?

Show worked solution

Inspect the durable synthetic records and queued effects to verify the agreed number of effects; success alone does not exclude duplication.

2. The client timed out and no safe state observation is available. What is the outcome?

Show worked solution

Unknown. Record the limitation and use the documented reconciliation process instead of claiming the operation failed.

Key takeaways

  • A timeout is a client observation, not a server outcome.
  • Verify retry effects under the specific documented contract.

Official references