4. Insert Data Into Responses

Applies to ReadyAPI 3.9, last modified on July 30, 2021

To add data to responses:

  1. In the virtual service editor, switch to the Setup page.

  2. Click the response (this will open the response property editor on the right), and in the DataSource section, select the data source we created on the previous step.

    Service virtualization and API testing: Select a data source for a response

    Click the image to enlarge it.

  3. In the property editor, go to the Edit section and switch to the Form tab. Click the ellipsis button and select Virtual Service Response [Response 1] > Property [Rate] from the menu:

    Service virtualization and API testing: Inserting property reference from the menu

We inserted the data source property into the response body. Now, before the virtual service sends the response, it will read data from the data source and insert the property value into the response. In ReadyAPI, this is called property expansion.

After sending the response, the service automatically moves to the next data source record. So, next time it needs to send a response, it will read data from the next row of the Excel sheet. When the service reaches the last row, it starts over from the first row.

Prev          Next

See Also

Data-Driven Virtual Services – Tutorial

Highlight search results