In LoadComplete, you can replace recorded cookie values with custom values. You create cookie replacers on the Data Replacers tab of the Scenario editor and, for each replacer, you set the following data in the Data Replacers table:
|Expression||The cookie name.
If you want to remove a cookie or to skip it for a request, you can set the cookie name with a regular expression. See below.
|Attribute||One or several cookie attributes. See below. Separate multiple attributes with a semicolon.|
|Variable||The name of the variable that stores the cookie value.|
|In addition to the Expires and Max-Age attributes that specify when to delete a cookie, you can also use the One-Shot attribute in LoadComplete. See below.|
For detailed information on Data Replacers and the Data Replacers table, see Data Replacers Panel.
In LoadComplete, you can use the following cookie attributes in your scenarios.
|Domain=<domain_name>||Specifies the domain where the cookie is valid.|
|Path=<any_path>||Specifies the subset of URLs where the cookie is valid.|
|Expires=<date>||Sets the expiration date for when the cookie will be deleted. The date must use the following format:
DAY, DD-MMM-YYYY HH:MM:SS GMT
|Max-Age=<value>||Sets the time difference value (in seconds) after which the cookie will be deleted.|
|Secure (does not have a value)||Specifies that a cookie can be sent only to HTTPS servers.|
|HttpOnly (does not have a value)||Specifies that a cookie can be used only via the HTTP protocol.|
The following attributes are LoadComplete-specific, they are not standard HTTP attributes. They are meaningful only for cookies that are created by cookie replacers (but not recorded). These attributes do not have a value.
|One-Shot||In general, after a replacer creates a cookie in some request, LoadComplete sends this cookie in all subsequent requests of the scenario. If the One-Shot attribute is set for a replacer, LoadComplete will send the cookie in one request only and will not send it in further requests.
Specifies that the cookie simulation will be skipped. The cookie will not be sent with the current request.
If you use this attribute, the cookie name in the Expression column can be specified with a regular expression. See below.
|Remove||Specifies that the cookie will be removed. If you use this attribute, the cookie name in the Expression column can be specified with a regular expression. See below.|
|RegExpr||Indicates that the cookie name is specified by a regular expression. Can be used along with the Remove or Skip attribute, see below. Helpful if the cookie name differs slightly from one user session to another.|
During the load test, LoadComplete will use the specified data to send the cookie.
To specify multiple values, separate them with semicolons (
If you use the Skip or Remove attribute, you can specify the cookie name in the Expression column with a regular expression. In this case, you should also use the RegExpr attribute to signal LoadComplete to handle that expression:
Suppose, you have a variable cookieVar=123. Specify the following cookie replacer:
|cookie1||@cookieVar||Expires=Sun, 01-Jan-2017 00:00:00 GMT|
When you run the load test, LoadComplete will simulate the following Cookie request header:
|Note that if the Expires attribute specifies the elapsed date, the cookie will not be simulated.|