Skip to content

mock/wait

Step Summary
mock/wait/http_request Wait for an inbound HTTP request on a previously-registered mock endpoint.

mock/wait/http_request

Wait for an inbound HTTP request on a previously-registered mock endpoint.

This is the other half of mock/api: that step hands the system under test a callback URL, and this one blocks until the SUT calls it, then hands the request it made to the assertions. Raises: RuntimeError: If no CallbackManager is available or the wait times out.

Inputs

Parameter Type Required Default Also accepts Description
mock MockInstance yes — — The mock to wait on, as returned by the step that registered it.
timeout_s number no 30.0 — Seconds to wait before failing.

Output — the value assertions and returns: read

The inbound request a mock endpoint received.

Field Type Description
request_method string HTTP method of the inbound request.
request_path string Path the request arrived on.
request_headers object Headers of the inbound request.
request_query_params object Query string parameters of the inbound request.
request_body any Body of the inbound request.
elapsed_ms integer Milliseconds spent waiting before the request arrived.

Nested objects

MockInstance

A registered mock, as the steps that use it later need to see it.

Field Type Required Default Also accepts Description
endpoint_id string no '' — Identifier the mock was registered under, when it was given one.
path string yes — — Path the mock listens on.
method string yes — — HTTP method the mock answers.
base_mock_url string yes — — Root URL of the testlab mock server.
full_mock_url string yes — — Address the system under test calls — root plus path.