This topic describes LoadComplete variables and explains how you can use them in your testing tasks.
In LoadComplete, you use variables to –
Parameterize requests. To simulate real-life conditions, you can supply virtual users in your tests with various parameters. You use variables to access needed test data stored in external files or produced by LoadComplete generators.
For example, you can create variables holding a list of user names and passwords and insert them into appropriate form fields in a login request. During the test run, virtual users will use individual credentials.
For detailed instructions, see Parameterizing Requests.
Correlate requests and responses. If your tested application generates dynamic parameters (like, session ID) to use them through the entire application session, you can extract the dynamic parameter value to a variable and feed it to further requests.
That is, you use variables to “transfer” dynamically generated data like session IDs and hidden form fields to subsequent requests in order for the simulated traffic to be properly correlated.
For more information, see Data Correlation.
Validate response data. You may want to check whether a request is simulated successfully by comparing data received from the server against expected data. To do this, extract a needed value from a server response to a variable and define a rule that verifies the value.
For complete information on checking response data, see Validating Response Contents.
Use these variables to access data that LoadComplete produces with its built-in data generators or extracts from external files (Excel, CSV or database records).
You can create them:
Using the Parameterization wizard. For more information on using the wizard, see Parameterizing Requests in the Parameterization Wizard.
Depending on the data the variables store, they can be of the following types:
These variables store data extracted from server responses. LoadComplete creates them automatically when:
LoadComplete creates data extraction rules during scenario recording.
LoadComplete uses these variables during the test run only. You can modify their values by using the Set Variable Value operation.
You can view a list of variables that are available in the scenario in the Variables editor.
If a scenario variable and an existing project variable have the same name, the scenario variable will override the project variable during simulation.
A scenario that calls other scenarios has access to all variables defined in those scenarios.
Scenarios called from a scenario have access to variables defined in other scenarios called from the same scenario.
Make sure your variable names do not include names of other variables (for example, MyVariable and MyVar). Otherwise, LoadComplete may fail to distinguish such variables when you insert them into the request header or body.
If your tested web server does not return a response from which you get your variable’s value before the correlation timeout elapses, LoadComplete will report an error. It will not simulate the request that uses the variable.
To check if a variable exists, use the If operation.