captureYield

fun captureYield(description: String, durationMs: Long)

Yields the test execution when capturing all web service requests or when not all web service requests have been replayed since the last execution of this call or since the start of the test.

This makes it possible to continue the capturing of requests after a test execution step finishes and to be able to replay them in following test executions (after adding them to the replay database).

Continuing the capturing of requests is required in a scenario like:

  1. A test plans a route.

  2. After the route overview is shown, the test starts the route demo.

When step 1 triggers all kinds of web service requests that may continue while step 2 is performed, it is required to capture these requests to ensure they are available in the capture database to replay these requests at a later test execution that might have slightly different timing.

When during the yield durationMs period a request is captured, the yield is prolonged by the durationMs until no other request is captured. It is possible to ignore certain requests (e.g. periodic traffic updates) by setting WebserviceMockConfig.doNotProlongCaptureYieldOnResponse to true.

No yield is performed when not capturing all requests and all requests where replayed.

Parameters

description

Human understandable description of why the yield is required. This description is logged before and after the yield period.

durationMs

The yield duration in ms.