How to correlate Cookies in HPE LoadRunner?

In this article you are going to learn about correlate cookies in HPE LoadRunner. Correlating is very critical and sometimes time consuming tasks during scripting. But without correlation you script is not complete. Before we jump into correlation, it is must to understand what is cookie and how it works.

What is HTTP Cookie?

An HTTP cookie also known as cookie, web cookie, browser cookie, internet cookie is a tiny piece of data that is transferred between user computer and a website that user is browsing. For example, if you are searching/browsing for PS4 console in one website, if you navigate another website, you could see ads related to PS4 console. Another example is sometimes you get emails/spams about the product you searched recently.

Cookies remembers stateful information and records your activity and stores passwords, form data that user had previously entered.

Is correlation required for Cookies?

During recording/scripting, it is important to consider whether you need to correlate cookies or not. To correlate cookies, just record your business action and see if there is any web_add_cookie() calls made to the website. If there are calls, then you need to correlate cookie in your script. Mostly, if you are working on eCommerce portals, you need to correlate cookie by default.

My way of judging is, I execute the script multiple times with multiple test data as-is, if I face any issues, then I consider correlating cookies, else, I simply ignore the cookies, to save time in correlation.

How to correlate cookies in HPE LoadRunner?

There are two ways of correlation that you can perform in HPE LoadRunner: Automatic and Manual. To correlate automatically, click on Design Studio and select the text in response and then click on Correlate button as shown below.

Design Studio Correlate Cookies in HPE LoadRunner
Design Studio

To correlate manually, first need to identify unique left and right boundary for the cookies. Then add web_reg_save_param_ex(); function with scope as Cookies as shown below.

Correlate Cookies Scope as Cookies
Correlate Cookies Scope as Cookies

Below is the sample function which has scope as cookies.

    web_reg_save_param_ex(
“ParamName=p_cookie”,
“LB=csm-hit”,
“RB=”,
“Ordinal=1”,
SEARCH_FILTERS,
“Scope=COOKIES”,
LAST);

It is best to add web_cleanup_cookies(); function at the top of your script which will cleanup all the cookies currently stored by the Vuser.

Correlate Cookies in HPE LoadRunner

2 thoughts on “How to correlate Cookies in HPE LoadRunner?”

  1. Very usefull information! I am facing problem for one script which has capturing the cookies. In vugen it is working fine with multiple user and multiple iteration. But in performance center during ramp up time after certain vuser it is getting failed.
    Saying 501 service unavailable authentication required for this operation. Could you please help on this issues

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Learn Kubernetes and Get Certified in CKAD.SHOW ME HOW
+ +
Share via
Copy link