Add Recorded Operations to Virtual Service

Applies to ReadyAPI 3.52, last modified on April 18, 2024

You can configure your virtual API (virtual service) to record requests that have not been virtualized yet. If you enable recording along with enabling request routing, you can quickly and easily add requests and responses of a real API to your virtual service.

Configuring Properties

  1. Open the virtual service editor.

  2. Switch Route and Record Non-Virted Requests from the Route Options drop-down list:

    Service virtualization and API testing: Recording requests

    Click the image to enlarge it.

    This setting commands the virtual service to route those incoming requests for which it has no virtual operations yet and to create a virtual operation from the routed request and a response to it from the real API.

Note: You can also record “real” responses for virtual operations in addition to the responses they already have. To do this, simply select the Record Responses check box for the desired operations (it is visible if Routing Mode is set to All or Conditional):
Service virtualization and API testing: Recording responses

Recording Traffic

  1. Click to start the virtual service.

  2. Send requests to the virtual service using your client application, browser, ReadyAPI or any other tool. ReadyAPI will record traffic and create a virtual operation for the routed requests and responses.

What Data Is Recorded

  • To avoid recording duplicates, the virtual service checks the header and body of incoming requests, as well as the data of the responses it receives from the real API:

    • If the virtual service detects a new request, it creates a new operation.

    • If the service detects a new response to some recorded request, it records only that response, and does not create a new operation.

    • If the service finds a request-response pair in the operation list, it does not record any new data.

    If the real API returns or can return different responses for the same request, then to record these responses you can simply send the request several times.

  • The virtual service checks the query parameters of incoming requests (they are specified in the URL after the question mark), and records a new response for each “new” parameter value. The response name indicates the parameter name and value:

    Service virtualization and API testing: Parameter names in the names of recorded responses

    Click the image to enlarge it.

    If a request has several parameters in the URL, the service records a separate response for each set of parameter values.

    Note that the virtual service automatically changes the Dispatch style setting to Parameter in virtual operations that were recorded for requests with query parameters (see the image above).

    The service does not store query parameters in the Resource Path property of the recorded request. This property includes the page (resource) path only:

    Service virtualization and API testing:

    Click the image to enlarge it.

See Also

Request Routing and Recording

Highlight search results