LoadRunner parameter array

Source: Internet
Author: User

The parameter array provides a mechanism for centralizing a class of parameters, where several functions that are built into LR are: Lr_paramarr_idx (), Lr_paramarr_len (), Lr_paramarr_random ()

At the same time, the parameter array must satisfy two conditions: the ① parameter must be preceded by the same name, followed by an underscore and the number of sequential assignment; The ② parameter array must have a parameter named _count to record the length of the number.

eg

Lr_save_string ("www.google.com", "website_1");

Lr_save_string ("www.baidu.com", "website_2");

Lr_save_string ("www.163.com", "website_3");

Lr_save_string ("www.sina.com.cn", "website_4");

Lr_save_string ("4", "Website_count");

This script creates an array of arguments named website, followed by a function to manipulate the array of arguments:

Char *siteval;

Siteval=lr_paramarr_idx ("website", 2)---------- output: www.baidu.com

  

Char *siteval

Siteval=lr_paramarr_random ("website")--------- output: Random values in the website parameter array

 

If you need to facilitate all of the contents of the entire parameter array, you can do so by:

int Arrid

For (Arrid=1;arrid<=lr_paramarr_len ("website"); i++)

{

Lr_output_message (Lr_paramarr_idx ("website", Arrid));

}

The following are examples of help manuals:

This is example shows how to get the last value from a parameter array.

int arrsize;

char * FLIGHTVAL;

Web_reg_save_param ("Outflightval",

"Lb=outboundflight value=", "rb=>",

"Ord=all",

"Savelen=18",

last);

Web_submit_form ("reservations.pl",

"Snapshot=t4.inf",

ItemData,

"Name=depart", "Value=london", Enditem,

"Name=departdate", "value=11/20/2003", Enditem,

"Name=arrive", "Value=new York", Enditem,

"Name=returndate", "value=11/21/2003", Enditem,

"Name=numpassengers", "value=1", Enditem,

"Name=roundtrip", "value=<off>", Enditem,

"Name=seatpref", "Value=none", Enditem,

"Name=seattype", "Value=coach", Enditem,

"Name=findflights.x", "value=83", Enditem,

"Name=findflights.y", "value=16", Enditem,

last);

/*

The result of the Web_reg_save_param has been called before the Web_submit_form is:

Notify:saving Parameter "Outflightval_1 = 230;378;11/20/2003"

Notify:saving Parameter "outflightval_2 = 231;337;11/20/2003"

Notify:saving Parameter "outflightval_3 = 232;357;11/20/2003"

Notify:saving Parameter "outflightval_4 = 233;309;11/20/2003"

Notify:saving Parameter "Outflightval_count = 4"

*/

Arrsize = Lr_paramarr_len("Outflightval");

Flightval = lr_paramarr_idx("Outflightval", arrsize);

Flightval contains the value "233;309;11/20/2003".

  

LoadRunner parameter array

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.