Highlighted
Absent Member.. Absent Member..
Absent Member..
702 views

he URL need solution to measure the response for tredirection in Loadrunner.

Hi,

I need the solution to measure the response for the URL redirection in Loadrunner. can any one suggest for that how to resolve that issues.

Thanks,
0 Likes
3 Replies
Highlighted
Super Contributor.
Super Contributor.

Re: he URL need solution to measure the response for tredirection in Loadrunner.

Set the redirection depth to 0, and use correlation to capture the redirection URL
In order to break the Web request that contains the redirection into two different transactions, you need to do the following:

1.Set the redirection depth to 0.
2.Once the redirection dept is set to 0, the redirected page will no longer load automatically. Instead, you have to capture the URL of the redirected page by examining the server response.

Once you have captured the redirection URL, you can create a URL call manually in your script.

Example:
web_url ("nextpage", "the_param_saved_redirection_url", ... );


Make sure you have lr_start_transaction and lr_end_transaction statements enclosing these calls so they belong to different transactions
With the above implementation, you will have two transactions. One for initial page, one for redirected page. The same applies to pages that have multiple redirection, just repeat step 2 and 3 for each redirection.
0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: he URL need solution to measure the response for tredirection in Loadrunner.

How to change the maximum redirection value

Add MaxRedirectionDepth=x to default.cfg
To increase/decrease the redirection value for all future scripts:
1. Go to the \template\qtweb directory.
2. Edit default.cfg using a word editor.
3. Locate the [web] section.
4. Add the entry for MaxRedirectionDepth.

Example:
[web]
MaxRedirectionDepth=x

where x is a number of redirections desired.

5. Repeat the same process for the default.cfg in the script directory.


To increase/decrease the redirection value for a specific script:
Add the following statement to the beginning of the script:

web_set_option("MaxRedirectionDepth", "x", LAST);

where x is a number of redirections desired.
0 Likes
Highlighted
Super Contributor.
Super Contributor.

Re: he URL need solution to measure the response for tredirection in Loadrunner.

How to capture the URL that is formed because of redirection

Use web_reg_save_param()
When that the server redirects a HTTP request to another URL, it normally does that by sending a HTTP 302 Moved header. To verify
1. Run the script in extended log with "data retuned by server' turned on
2. Check the execution log for "302 moved'

You can also see that along with this header, the server also sends the following header information:
"Location: ."

The URL specified in the "Location' header will be the URL that the original HTTP request be redirected to. To capture this URL, you have to capture the string between "Location:" and "\r\n" (end of line).

Example:

Action()
{

//use the correlation statement to capture the redirection
web_reg_save_param ("Redirection", "LB=Location: ","RB=\r\n" ,LAST );

//Visit Mercury homepage
web_url("Mercury","URL=http://www.mercury.com/", LAST);

//Print the redirected URL
lr_message("redirected address = %s", lr_eval_string("{Redirection}"));

return 0;
}

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.