loadrunner中存储表格参数|loadrunner关联多个参数|loadrunner关联数组

loadrunner中存储表格参数|loadrunner关联多个参数|loadrunner关联数组

Action()
{

    int i,count;
    char buffer[1024]={0};

 web_set_max_html_param_len("1024");

 /* Registering parameter(s) from source task id 54
 // {CSRule_1_UID2} = "102354.129364115fcztitApfcQVzzzHDVfiQpAtDVHf"
 // */

// ========可惜,不能用regular express.......

 web_reg_save_param("CSRule_1_UID2", 
  "LB=userSession value=", 
  "RB=>", 
  "Ord=1", 
  "Search=Body", 
  "RelFrameId=1.2.1", 
  LAST);

 web_url("mercuryWebTours", 
  "URL=http://127.0.0.1:1080/mercuryWebTours/", 
  "Resource=0", 
  "RecContentType=text/html", 
  "Referer=", 
  "Snapshot=t5.inf", 
  "Mode=HTML", 
  LAST);

  lr_output_message("参数是:%s",lr_eval_string("{CSRule_1_UID2}"));
 lr_think_time(13);

 web_submit_data("login.pl", 
  "Action=http://127.0.0.1:1080/mercuryWebTours/login.pl", 
  "Method=POST", 
  "RecContentType=text/html", 
  "Referer=http://127.0.0.1:1080/mercuryWebTours/nav.pl?in=home", 
  "Snapshot=t6.inf", 
  "Mode=HTML", 
  ITEMDATA, 
  "Name=userSession", "Value={CSRule_1_UID2}", ENDITEM, 
  "Name=username", "Value=test", ENDITEM, 
  "Name=password", "Value=123123", ENDITEM, 
  "Name=JSFormSubmit", "Value=on", ENDITEM, 
  "Name=login.x", "Value=42", ENDITEM, 
  "Name=login.y", "Value=7", ENDITEM, 
  LAST);

  web_reg_save_param("param1", 
  "LB=name=/"flightID/" value=/"", 
  "RB=;/"", 
  "Ord=ALL",
  LAST);

 web_image("Itinerary Button", 
  "Alt=Itinerary Button", 
  "Snapshot=t7.inf", 
  LAST);


 lr_output_message("找到参数个数为:%s",lr_eval_string("{param1_count}"));

 count=atoi(lr_eval_string("{param1_count}"));  // atoi把字符串的数字转换为整形的数字

    for(i=1;i<=count;i++)
 {
  sprintf(buffer, "{param1_%d}", i);
  lr_output_message("第%d的参数是:%s", i, lr_eval_string(buffer));
 
 }

 web_image("SignOff Button", 
  "Alt=SignOff Button", 
  "Ordinal=1", 
  "Snapshot=t8.inf", 
  LAST);

 return 0;
}

 

from:http://blog.csdn.net/namesliu/article/details/5196263

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值