Random variables return a random value from the specified range every time the variable is accessed during the test run. You can use these variables to make your load tests dynamic by parameterizing requests with random values:
GET /cart/add/?pid=@ProductID HTTP/1.1
For example, if you configure the variable in the example above to generate random values from 1 to 100, different virtual users will be able to send this request with different parameters:
GET /cart/add/?pid=15 HTTP/1.1
GET /cart/add/?pid=97 HTTP/1.1
GET /cart/add/?pid=42 HTTP/1.1
and so on
This way, your virtual users will be able to browse or order random items in your tested online shop. As a result, you will get more realistic behavior than that when using the same recorded values for all virtual users.
|We recommend that you select a variable whose data type matches the parameter data type. If LoadComplete fails to convert the variable value to the parameter data type, the test server may raise an error.|
Random variables have the following parameters:
Prefix and Suffix
From and To
|Note:||When generating random dates, specify the From and To values in the short date format that is defined in the Regional and Language Options on the current computer. For example, if your computer uses the English (United States) format, the June 24, 2008 date should be specified as 6/24/2008.|
- Integer (default)
Note that the value type also determines the format of the generated values. When a virtual user requests the variable value during the load test run, the value is returned in the format defined by the Regional and Language Options on the virtual user’s workstation. For example, the June 24, 2008 date will be formatted as 6/24/2008 on workstations with English (United States) format settings, as 24.06.2008 on workstations with German format settings, as 2008-06-24 on workstations with Polish format settings, and so on.