LoadRunner中多值关联的处理方式-创新互联
本篇内容主要讲解“LoadRunner中多值关联的处理方式”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“LoadRunner中多值关联的处理方式”吧!
创新互联-专业网站定制、快速模板网站建设、高性价比玉林网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式玉林网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖玉林地区。费用合理售后完善,10年实体公司更值得信赖。需求:通过关联取得的ParamName参数可能存在多个值,需要对每个ParamName参数值进行处理
脚本:可通过3种不同的实现方式,将每个参数值作为HTTP请求内容发出
web_reg_save_param("ParamName",
"LB/IC="id":"OutputParameter.",
"RB/IC=","",
"Ord=All",
"Search=Body",
"RelFrameId=1",
LAST);
...
Paramcount=atoi(lr_eval_string("{ParamName_count}")); //参数个数
i=1;
while (i<=Paramcount) {
sprintf(str,"{ParamName_%d}",i); //生成ParamName_i
//方法一:将变量转为参数,直接在请求中使用参数
lr_save_string(lr_eval_string(str),"Value"); //对每个参数进行处理
web_submit_data("FreeQueryServlet_24",
"Action=http://datasvr01:8081/freequery/FreeQueryServlet",
"Method=POST",
"RecContentType=text/html",
"Referer=http://datasvr01:8081/freequery/js/freequery/businessview/Preview.html",
"Snapshot=t27.inf",
"Mode=HTTP",
ITEMDATA,
"Name=className", "Value=ClientReportService", ENDITEM,
"Name=methodName", "Value=addNewParam", ENDITEM,
"Name=params", "Value=["{ClientID}","OutputParameter.{Value}",""]", ENDITEM,
LAST);
//方法二:通过strcpy、strcat方式组织字符串,通过变量发送请求
strcpy(s,"Value=["{ClientID}","OutputParameter.");
strcat(s,str);
strcat(s,"",""]");
web_submit_data("FreeQueryServlet_24",
"Action=http://datasvr01:8081/freequery/FreeQueryServlet",
"Method=POST",
"RecContentType=text/html",
"Referer=http://datasvr01:8081/freequery/js/freequery/businessview/Preview.html",
"Snapshot=t27.inf",
"Mode=HTTP",
ITEMDATA,
"Name=className", "Value=ClientReportService", ENDITEM,
"Name=methodName", "Value=addNewParam", ENDITEM,
"Name=params", s, ENDITEM,
LAST);
//方法三:通过sprintf格式化输出生成需要的字符串,通过变量发送请求
sprintf(s,"Value=["{ClientID}","OutputParameter.%s",""]",str);
web_submit_data("FreeQueryServlet_24",
"Action=http://datasvr01:8081/freequery/FreeQueryServlet",
"Method=POST",
"RecContentType=text/html",
"Referer=http://datasvr01:8081/freequery/js/freequery/businessview/Preview.html",
"Snapshot=t27.inf",
"Mode=HTTP",
ITEMDATA,
"Name=className", "Value=ClientReportService", ENDITEM,
"Name=methodName", "Value=addNewParam", ENDITEM,
"Name=params", s, ENDITEM,
LAST);
i++;
}
到此,相信大家对“LoadRunner中多值关联的处理方式”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
当前名称:LoadRunner中多值关联的处理方式-创新互联
当前路径:http://ybzwz.com/article/pidee.html