A constant variable is a variable whose value is predefined and does not change during the scenario execution. You can use such variables to specify some common request parameters. This way, you can quickly change these parameters without having to directly modify recorded traffic.
Below, are examples of GET requests that use hard-coded parameters and variables in the query string:
GET /report?date=Oct+4%2C+2010 HTTP 1.1
Recorded request with a hard-coded date
GET /report?date=@ReportDate HTTP 1.1
|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.|
For more information about using variables in requests, see About Variables.
Constant variables have the following parameters:
The variable name, which will be used to refer to this variable in request parameters. The name can include only letters (A..Z, a..z), digits (0..9) or underscores ( _ ) and must be unique within the project.
The type of the Value:
This option is only useful if you are going to run the scenario on multiple workstations with different Regional and Language Options. If you select a value type other than String, each virtual user will get the value in the corresponding format defined on that user’s workstation.
For example, if you select the Date type, 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.
The variable value. If you want this value to be treated as a number or a date, select the corresponding Value Type.
Dates must be specified in the short date format defined in the Regional and Language Options on the current computer. For example, if the computer where you are editing the scenario uses the English (United States) format, the date June 24, 2008 should be specified as 6/24/2008.
Integer values must be specified in the range
Float values must be specified in the range