To add data to responses:
-
In the virtual service editor, switch to the Setup page.
-
Click the response (this will open the response property editor on the right), and in the Data Source section, select the data source we created on the previous step.
-
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:
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.