Cookies are small text strings set by the web server and stored on the client side. They maintain client-specific information.
Cookies can be of two types: persistent and session. Session cookies exist in memory during the web browser session. Persistent cookies have an expiration date and are stored in the <Windows>\System folder.
A cookie can be associated with a single web page, or with a number of pages, or the entire web site.
Why Cookie Handling Is Important?
To avoid possible problems with cookies:
(Recommended.) Activate the web browser’s private mode before the traffic recording.
– or –
Clear the cookies and the browser’s temporary files before recording traffic.
Configure LoadComplete to correlate cookies in recorded traffic automatically.
For more information, see Preparing LoadComplete.
To use recorded cookies for all virtual users in tests, enable the Use recorded cookies option. This way, cookies will affect the server response and the server will produce the same responses that it produced during the recording.
Note: The cookie expiration period can be short and the recorded cookies may expire by the time you start the test. In addition, the recorded cookies may become useless if developers change functionality for the web server under test. Therefore, choose this mode if the web server under test uses persistent cookies with long expiration periods and if the web server functionality is not to change.
By default, LoadComplete correlates cookies automatically. When the Use real-time cookies option is enabled, LoadComplete gets the cookies the server returns and uses them in subsequent requests.
In addition, you can configure LoadComplete to get specific cookies from responses and to insert them into requests:
In the Data Correlation Options dialog, enable the Common/Cookie correlation rule.
When you command LoadComplete to correlate a recorded scenario, it creates data selectors to extract cookie values from responses and cookie replacers to insert cookie values into subsequent requests in the scenario.
Handling Cookies in Continuous Load Tests
If you use the continuous load feature, LoadComplete may restart virtual users during the test run. This happens if the current number of virtual users is less than the number required by the load profile settings.
To command LoadComplete to clear cookies of restarted virtual users, disable the Reuse virtual cookies when simulating continuous load option before you run the test (the option is disabled by default). The server will treat restarted users as new users that come to the web site for the first time.
To keep collected cookies, enable the Reuse virtual cookies when simulating continuous load option. The server will treat the restarted users as returning users and will "know" about their previous actions on the web site.
Handling Cookies in Cross-Origin Resource Sharing (CORS) Requests
Cross-origin resource sharing (CORS) is a mechanism that allows a client-side web application running on one server to access resources residing on another server. CORS requests and responses use special headers to specify how the needed resources will be shared.
LoadComplete detects CORS requests by the
Typically, CORS requests do not include cookies or user credentials. When simulating CORS requests, LoadComplete does not simulate cookies set by the tested web server in CORS requests:
If your CORS requests include cookies (the web server must be configured to accept cookies in CORS requests), LoadComplete will detect them during traffic recording and will simulate them during the test run:
Internet Explorer 11 does not send the
Origin header in CORS requests. If you record your traffic in Internet Explorer 11, LoadComplete will not be able to recognize the recorded requests as CORS requests, and may not be able to simulate them correctly. As a workaround, you can do one of the following:
Record your scenarios in a web browser other than Internet Explorer 11.
— or —
Originheader to the needed requests manually after the recording is over.