qileilove

blog已经转移至github,大家请访问 http://qaseven.github.io/

LoadRunner关联的高级应用

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;
}

posted on 2013-08-22 11:06 顺其自然EVO 阅读(237) 评论(0)  编辑  收藏 所属分类: loadrunner


只有注册用户登录后才能发表评论。


网站导航:
 
<2013年8月>
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567

导航

统计

常用链接

留言簿(55)

随笔分类

随笔档案

文章分类

文章档案

搜索

最新评论

阅读排行榜

评论排行榜