LoadRunner关联的高级应用

发表于:2013-8-21 11:00

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:andyguo    来源:51Testing软件测试网采编

Action()
{
int array_len ,i=1;
char array_name[20];

  //通过关联找出所有的省市的连接地址

web_reg_save_param("outFlightVal",
"LB=\"http:\/\/a.lietou.com\/",
"RB=.shtml\">",
"ORD=ALL",
LAST);
web_url("a.lietou.com",
"URL=http://a.lietou.com",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t25.inf",
"Mode=HTML",
EXTRARES,
LAST);

  //计算获取省市的个数,为下面的循环访问做准备

array_len=atoi(lr_eval_string("{outFlightVal_count}"));
lr_output_message("%d",array_len);
for (i=1;i<=array_len;i++) {

  //拼接省市请求url

sprintf(array_name,"{outFlightVal_%d}",i);
lr_output_message("%s",lr_eval_string(array_name));
lr_save_string(lr_eval_string(array_name),"shen");

  //关联获取title字段内容

web_reg_save_param("title",
"LB=<title>",
"RB=</title>",
"ORD=1",
LAST);

  //关联获取content字段内容

web_reg_save_param("content",
"LB=content=",
"RB=\/>\r\n",
"ORD=1",
LAST);
web_url("a.lietou.com",
"URL=http://a.lietou.com/{shen}.shtml",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t25.inf",
"Mode=HTML",
EXTRARES,
LAST);
}
return 0;
}

《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号