Lr Advance Param Function In Loadrunner With Example

This function is not recorded during recording. We manually insert this function whenever there is a need of it. lr_advance_param works depends upon the settings we give in parameter list (ctrl+L). lr_advance_param is like update value on each occurrence. Whenever we want to update a parameter value in the same iteration we use lr_advance_param.

For example when we want to use two parameters Google and Bing in one Iteration. Usually the Vugen takes the first value google and if we want to use the second value in the same iteration we use update value on each occurrence in the parameter settings. We can do the same using lr_advance_param function.
Example:

I have set following settings in Parameter


Select Next Row: Sequential

Update value on: Each Iteration

If we want to take the next value in the pramater list we use lr_advance_param as shown below.

Parameter Name: DomainName
Google
Bing
Yahoo
Ask

Vugen Script:

Action()
{
web_url("Google Home Page",
"URL=http://www.{DomainName}.com",            Here the parameter value is google.
"Resource=0",
"RecContentType=text/html",
"Mode=HTML",
LAST );

web_url("Google Home Page",
"URL=http://www.{DomainName}.com",          Here also the parameter value is google.
"Resource=0",
"RecContentType=text/html",
"Mode=HTML",
LAST );

lr_advance_param("DomainName");               We are using lr_advance_param here. so it will take bing now.

web_url("Bing Home Page",
"URL=http://www.{DomainName}.com",        So Here the parameter value is Bing.
"Resource=0",
"RecContentType=text/html",
"Mode=HTML",
LAST );

return 0;
}

Output:

Starting iteration 1.
Starting action Action.
web_url("Google Home Page") started                 [MsgId: MMSG-26355]
Redirecting "http://www.google.com" (redirection depth is 0)  [MsgId: MMSG-26694]
To location "http://www.google.co.in/?gws_rd=cr&ei=xnNKUq3RNYqKrgeGioCQAQ"    Found resource "http://www.google.co.in/images/icons/product/chrome-48.png" in HTML "http://www.google.co.in/?gws_rd=cr&ei=xnNKUq3RNYqKrgeGioCQAQ"
web_url("Google Home Page") was successful, 12754 body bytes, 1993 header bytes

web_url("Google Home Page") started                 [MsgId: MMSG-26355]
Redirecting "http://www.google.com" (redirection depth is 0)  [MsgId: MMSG-26694]
To location "http://www.google.co.in/?gws_rd=cr&ei=x3NKUresGoKVrAehnoDIAw"
Resource "http://www.google.co.in/images/icons/product/chrome-48.png" is in the cache already and will not be downloaded again
web_url("Google Home Page") was successful, 10928 body bytes, 1324 header bytes

Action.c(19): web_url("Bing Home Page") started            [MsgId: MMSG-26355]
Action.c(19): web_url("Bing Home Page") was successful, 13968 body bytes, 1130 header bytes
Ending action Action.
Ending iteration 1.

Comments

Popular posts from this blog

web_set_max_html_param_len

Error -27492: "HttpSendRequest" failed, Windows error code=12057 (certificate revoked) and retry limit (0) exceeded for URL="