Occasionally, you might want to perform the same action multiple times with different parameters. While you should be very carefull with this type of scripting, the following is a basic example of how to do this in LoadRunner.
The following script will perform three searches on google.com.au using three different parameters.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | Action() { int i; char temp[10]; // Progress Through 3 Client IDs stored in {Param_1}, {Param_2} and {Param_3} for(i=1;i<4;i++) { sprintf(temp,"{Param_%d}",i ); lr_save_string(lr_eval_string(temp), "Param_Value"); lr_start_transaction("Search"); // Extract Variables web_reg_save_param("Number_of_Results", "LB=About ", "RB= results", LAST); // Validate Content web_reg_find("Text=<title>{Param_Value} - Google Search</title>", LAST); web_url("search", "URL=http://www.google.com.au/#hl=en&q={Param_Value}", "Resource=0", "RecContentType=text/html", "Referer=", "Snapshot=t1.inf", "Mode=HTML", LAST); lr_end_transaction("Search", LR_AUTO); } return 0; } |


Here is a familiar situation. Thousands of potential accounts for use in performance testing, some of which work, some don’t. In this example, it’s the login credentials. This usually requires you to run through your test data one by one to see which accounts work, and which don’t, removing the accounts that error. By
Quick tip: If you find VuGen is running slowly, it’s probably because you have the parameters data file open.

I recently came across a problem with trying to record a login to a website. After posting my login credentials, I received a 302 redirect that contained several Authentication cookies. Unfortunately, LoadRunner was not recognising the cookies and the subsequent page redirected me back to the login page.