Promote Sub-request Rule

The Promote Sub-request rule is one of the rules you can apply when you generate a web virtual user (VU) script in Eggplant Performance using the Generation Rules wizard. The sub-requests in the recording that match the criteria will be promoted to top-level requests. This means that the response content sent back from the server is available in the script.

To apply a generation rule to any request, it must be a top-level request. This rule can be used to promote sub-requests in order for other generation rules to be applied to them.

Promote Sub-request rule diagram

This rule is useful for accessing non-HTML response content.  It is also useful if you want to apply other script generation rules to non-HTML response content.

Example Script Code Changes (Java)

The following diagram illustrates how the Promote Sub-request rule works:

Url url1 = new Url(protocol1, "www.example.com", "/");

try (Request request1 = getWebBrowser().createRequest(HttpMethod.GET, url1))

{

request1.addSubRequest("http://www.example.com/res/data.json?orderID=12345&quantity=5");

 

try (Response response1 = request1.send())

{

....

}

}

Changes to the following:

Url url1 = new Url(protocol1, "www.example.com", "/");

try (Request request1 = getWebBrowser().createRequest(HttpMethod.GET, url1))

{

try (Response response1 = request1.send())

{

....

}

}

 

Url url2 = new Url(protocol1, "www.example.com/res/data.json", "connect");

 

QueryData queryData2 = new QueryData();

queryData2.add("orderID", "12345");

queryData2.add("quantity", "5");

url2 = url2.withQuery(queryData2);

 

try (Request request2 = getWebBrowser().createRequest(HttpMethod.GET, url2))

{

try (Response response2 = request2.send())

{

....

}

}

After applying this rule, a Data Correlation rule could be used to correlate the sessionID of 12345678 in the new top-level request, for example.

Generation Rules Wizard Pages

Create Request Filter

Since the purpose of this rule is to promote sub-requests, the only information required is which requests to promote. These can be described by creating a request filter on the common Create Request Filter page.

Note: You must add at least one condition (otherwise the rule would have no effect).

After the Create Request Filter page, the common Rule name and summary page appears.

 

This topic was last updated on January 13, 2022, at 02:42:23 PM.

Eggplant icon Eggplantsoftware.com | Documentation Home | User Forums | Support | Copyright © 2022 Eggplant