Verify Response Length Rule

The Verify Response Length rule is one of the rules you can apply when you generate a web virtual user (VU) script from a recording in [General.EpP] [General.Studio]using the Generation Rules wizard. To ensure that the server's responses to the virtual user's (VU's) requests are correct, you can configure the script to perform a simple check to verify that the length of a response is what is expected, plus or minus a tolerance value, using the Verify Response Length rule.

The Verify Response Length rule is useful if the other Verify rules (Verify Title, Verify HTTP Response Status Code, or Verify Contains) are successful, but the returned page differs slightly from what was expected.

See also:

How the Verify Response Length Rule Works

Verify Response Length rule diagram

Example Script Code Changes (Java)

The following example code shows the effect of applying a Verify Response Length rule. The examples use the following values:

Expected length (bytes): 60

Length tolerance: +/- 16%

try (Response response1 = request1.send())

{

....

}

Changes to:

try (Response response1 = request1.send())

{

response1.verifyLength(60, 16, ActionType.ACT_WARNING);

....

}

Generation Rules Wizard Pages

Set the expected content length page

The Verify Response Length rule uses the Set the expected content length page to determine what response length (bytes) to expect.

The value obtained must be an integer (e.g. 1,024). This affects the Data value option, because the script expects to retrieve an integer from the data dictionary using getInt(string key).

This page provides the Value from data dictionary, Fixed value, and Function call (advanced) options, which all work basically as described in Choosing a Value.

In addition, the Fixed value option requires an integer for the Expected length value, and provides a box for you to enter a value or use the arrows to display a value. In all four cases, there is also an option to enter a Length tolerance percentage, which you can enter in the other similar box.

Set expected response length page for the Verify Response Length rule in the Generation Rules Wizard

This page also provides the Length of recorded response option. This option enables you to use the recorded value as an expected length.

After the Set the expected content length page, you use the common Success/failure options page to specify what action to take if the response length does not equal the expected value, to within +/- the tolerance value percentage.

After the Select Success/Failure options page, the common pages Create Request Filter and Rule Name and Summary follow.

 

This topic was last updated on August 19, 2021, at 03:30:52 PM.

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