LoadRunner Handling of cookies
The common functions associated with cookie processing in LoadRunner are as follows:
Web_add_cookie (): Add a new cookie or modify a cookie that already exists
Web_remove_cookie (): Delete the specified cookie
Web_cleanup_cookies (): Delete all cookies Saved by VUser
Web_reg_add_cookie (): Added to Cookie if certain text is found
Classic questions and answers to cookie processing in LoadRunner:
1: Do Vugen process cookies when recording VUser scripts?
Vugen automatically handles all cookies that are set through the HTTP header. However, Vugen cannot always correctly be located on the reason JavaScript or <meta-> tag settings Cookie.
2: When I run the Web vuser script, will vuser reuse the same Cookie that was used to record the VUser script?
It may or may not, depending on the type of Cookie.
Cookies can be categorized into two categories: persistent cookies and session cookies:
Persistent Cookie: A plain text string that identifies your identity to the WEB server and is valid for a limited period of time. Persistent cookies are stored on the hard disk.
Session Cookie: A plain-text string that identifies your identity to the WEB server only during the current access (session). Session cookies are not stored on the hard disk.
When you record a Web vuser script, Vugen detects all cookies that are sent to the browser.
Vugen will differentiate between persistent cookies and session cookies as follows:
Permanent Cookie:vugen record the details of a permanent Cookie directly into a vuser script. Vugen uses Web_add_cookie to include persistent cookies in vuser scripts. When you run the VUser script, VUser will use these persistent cookies as needed.
Session Cookie:vugen does not protect the session Cookie that is used during the recording session. Instead, the session Cookie is cached when recording, and then discarded when the recording is stopped.
When you run the VUser script, VUser uses a new session Cookie that is received from the WEB server. That is, VUser does not re-use the same session Cookie that was generated when the script was recorded. These session cookies are stored in the VUser cookie cache and then discarded when the vuser is stopped. VUser does not save these session cookies.
Question 3: Does each vuser have its own unique Cookie cache?
Yes, each vuser has its own unique Cookie cache-session cookies are not shared, even if VUser runs on the same load generator.
4: Must the Cookie be parameterized in the recorded VUser script before running the script?
Sometimes needed. When recording a script, Vugen will copy the persistent Cookie into the VUser script. When you run the VUser script, VUser uses the persistent Cookie that you recorded. If each vuser requires a unique persistent cookie, you will need to parameterize the cookie in the VUser script.
Cookie interpretation and usage in LoadRunner