In LoadComplete, you can change the URLs of requests to simulate. You can replace URL parameters and arbitrary parts of URLs with variables containing data extracted from preceding responses or data that LoadComplete generates or gets from external files.
Why Inserting Variables into URLs
A URL of a tested web page may contain session or user identifiers. For example, if a web site assigns the
id272 identifier to a user session, the request URLs will look like this –
If request URLs in your recorded scenario contains such dynamic values, a test using that scenario most likely will not work correctly when you run it for multiple virtual users. This may happen because all virtual users will have the same ID.
To solve the problem, replace the recorded value in the URL with the variable containing the expected data.
Inserting Variable Values Into Request URL Parameters
Find the request in whose URL you want to use a variable value and open this request for editing.
In the Request Header table of the Request page, expand the Request | Query node and examine the request parameters.
Select the needed parameter.
In the Value column, enter the name of the variable that stores the needed value or click and select the variable in the resulting dialog.
If you type the variable name, be sure to prefix it with
@(that is, enter
@variableName). Else, the editor will consider the variable name as a string.
Inserting Variables Into URLs
Select the request in whose URL you want to use a variable.
Switch to the Request page, if it is not selected.
In the Request Header table of the Request page, expand the Request | Path node.
In the Value column, replace the needed part of the URL with a variable. Add the
@prefix to the variable name, that is,
To insert a variable to a URL, use the
@ symbol followed by the variable name: @VarName.
You can use variables to replace:
URL paths - parts between the / characters:
Values of query string parameters:
Both of the above:
You can use several variables to parameterize different parts of a URL:
The following is not supported. LoadComplete will not insert a variable value into a request:
Variables followed by characters other than the separators /, ? and &. Semicolons (;) are not separators:
One variable after another without separators:
Variables used as the names of query string parameters: