loadrunner一个小例子(HTTP Post)

上一篇 / 下一篇  2016-01-06 10:31:08

脚本编写


Action()
{
web_custom_request("web_custom_request",
"URL=http://urlhead/CpcService.ashx?Method=checkXXXed",
"Method=POST",
"Resource=0",
"RecContentType=application/json",
"Referer=",
"Mode=HTTP",
"EncType=application/json",
"Body={\"user\":{\"uid\":\"C8-9C-DC-70-BD-B2\"}}",
LAST);

web_reg_save_param("user_tags",
"LB=user_tags\":[\"",
"RB=\"]}",
LAST);
lr_message ("user_tags:%s", lr_eval_string("{user_tags}"));
//参数化脚本
if (atoi(lr_eval_string("{user_tags}"))==0)
lr_output_message("user_tags:%s,succeed!",(lr_eval_string("{user_tags}")));
else if(atoi(lr_eval_string("{user_tags}"))==1)
lr_output_message("user_tags:%s,failed!",(lr_eval_string("{user_tags}")));
else
lr_output_message("user_tags:%s,unknow!",(lr_eval_string("{user_tags}")));


return 0;
}

输出日志:
Action.c(24): [C8-9C-DC-70-BD-B2]0,succeed!
Action.c(26): [C8-9C-DC-70-BD-B3]1,failed!


TAG:

 

评分:0

我来说两句

日历

« 2024-04-04  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 40441
  • 日志数: 32
  • 建立时间: 2015-01-07
  • 更新时间: 2018-05-24

RSS订阅

Open Toolbar