码迷,mamicode.com
首页 > 其他好文 > 详细

loadrunner接口测试脚本

时间:2015-01-27 17:41:12      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:

使用get请求http,查看平均响应时间,以及TPS,code如下:

get()
{
	//get方式接口
	//char *errorcode;
	//int res;

	//lr_start_transaction("get");
   /* web_reg_save_param("Result",
		"Notfound=error",
		"LB=<result>",
		"RB=<\/result>",
		"Search=All",
		LAST);
*/
	lr_start_transaction("get");
	web_reg_find("Text=items","SaveCount=itemsCount",LAST);

	web_url("get", 
			//"URL=http://audi.autonavi.com/mapapi/poi/search-with-keyword?key=audi_live&md5=36c3bc8a2e0561fd16809e22afe83355&from=audi_mmi&language=zh-cn&keyword=zhongguancun", 
            //"URL=http://10.2.134.29:8008/ws/mapapi/poi/search?channel=autonavi&query_type=TQUERY&keywords=%E7%89%9B%E8%82%89%E9%9D%A2&qii=false&sign=B45FABB19203F2655BA5CD49F646222D&from=telematics-test",
			"URL=https://telematics-test.autonavi.com/bmw/fts/search?OP=fts&app_id=bmwfts&app_code=gft9Hbdn7qVaI4GAC51G0qRGIVgPZ3Tf8J4Ly1Yy&q=KFC&in=39.994613,116.479143%3br=10000000&size=50&accept-language=zh-CN&accept=application/json&accept-encoding=gzip&tf=plain&user-agent=BMWcar",
            "RecContentType=application/json",
			LAST);

	//lr_end_transaction("get", LR_AUTO);

	if(atoi(lr_eval_string("{itemsCount}")) > 0){
		lr_output_message("本次请求成功");
		lr_end_transaction("get", LR_PASS);
	}
	else{
		lr_error_message("本次请求失败");
		lr_end_transaction("get", LR_FAIL);

		return 0;
	}

 

loadrunner接口测试脚本

标签:

原文地址:http://www.cnblogs.com/BUGU/p/4253255.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!