How would you test a report that becomes available asynchronously?

Instruction: Describe the polling algorithm, success assertion and failure evidence. Keep the entire wait within the promised deadline.

Context:

A fictional report API accepts one POST /reports with HTTP 202 and a unique report ID. From receipt of that response, the contract promises that GET /reports/{id} becomes HTTP 200 with state: ready within 5 seconds. Until then, 404 or HTTP 200 with state: pending is valid. A ready report must contain the requested account ID and exactly 12 seeded rows. All other statuses and state: failed are failures in this controlled fixture. A request adapter can enforce a supplied per-request time budget; the runner has a monotonic clock.

Updated

Official answer available

Read the opening below, then unlock the full answer and practical guidance.

I would submit once, validate the acceptance response and keep its report ID. I would start one monotonic five-second deadline when that response is received, then poll only that report...

Related Questions