通过loadrunner将http返回response写入文本txt中

脚本如下

Action()
{
	int myFile;//lr不支持FILE类型,所以定义一个int类型的file

	web_reg_save_param("goods_price",//保存response回来的所需数据
						"LB=\"item-num\">",
						"RB=</div>",
						"Search=Body",
						LAST);

	web_url("buy",//访问web地址
			"URL=http://vip.baiyou100.com/1030000.asp?Product=1738",
			LAST);

 	myFile=fopen("d:\\1.txt","a+");//定义file的路径和写入方式为附加

 	fprintf(myFile,"%s\n",lr_eval_string("{goods_price}"));//写入数据

	return 0;
}

如图1,设置Run执行3次后,在生成的txt中可以看到如下图

1

2

posted @ 2016-02-28 11:33  xxyBlogs  阅读(849)  评论(0编辑  收藏  举报