Creating secondary HTTP requests

A recording creates multiple HTTP requests and responses. In some cases, a response from the server can be dynamic, because of which the subsequent requests might need to be modified. While playing back the test, some of these dynamic requests might fail. For example, recording and playback might involve a different set of users with different permission settings or the UI elements might have changed since the time you recorded the test. To ensure that the test is played back without the need to record it again, you can create secondary requests which, based on the response received from the server, fetch the exact values that the test requires .

About this task

You identify the HTTP request for which to create a secondary request, and then create a reference for all the occurrences to dynamically generate the request. If you do not want to create a reference, you can define an array variable that lists the HTTP requests to use from playback. You can use the array variable from custom code.
From version 9.1.0.1 or later, you can also specify the number of requests to be send to the server in the Test Editor itself. After creating the secondary HTTP request, in the HTTP Secondary Request Generator Details area, specify the total number of requests. If the number of requests is greater than 0, the number that you specify in Total number of requests takes precedence over the array variable.HTTP Secondary Request Generator

You can also use the delays to control the flow of the requests to the server. In the Advanced tab, go to the Delay Between Requests section and select the parameters for the flow of the requests. In Release When, select when exactly to release the request. For instance, First Character Sent indicates to release the second request after the first character in the first request is sent.

Procedure

To create a secondary HTTP request:
  1. Create a reference. See the Creating a reference topic.
  2. Right-click the HTTP request for which to create the secondary request and click Create Secondary HTTP Request Generator. You can also select multiple HTTP requests that have common headers or connection attributes. If multiple requests do not have common attributes, you are prompted to select one request as template.
    The original HTTP requests are disabled, indicating that the playback will now use only the secondary HTTP request.
  3. Run the test.