Action()
{
lr_start_transaction("check");
//从http://***/***/init接口返回的结果中取is_start,round,lottery_id值作为下一个请求的参数
web_reg_save_param("is_start",
"LB=\"is_start\":",
"RB=\,",
LAST);
web_reg_save_param("round",
"LB=\"round\":",
"RB=\,",
LAST);
web_reg_save_param("lottery_id",
"LB=\"lottery_id\":",
"RB=\}",
LAST);
web_custom_request("init",
"URL=http://***/***/init",
"Method=GET",
"Resource=0",
"Referer=0",
"Mode=HTML",
LAST);
//写入cookie数据
web_add_cookie("is_start={is_start};path=/u1-red-envelopes;domain=marketing.smartisan.com");
web_add_cookie("lottery_id={lottery_id};path=/u1-red-envelopes;domain=marketing.smartisan.com");
web_add_cookie("round_number={round};path=/u1-red-envelopes;domain=marketing.smartisan.com");
web_add_cookie("wechat_openid={openid};path=/u1-red-envelopes;domain=marketing.smartisan.com");
//文本检查,判断接口中是否返回了"code":0
web_reg_find("Search=Body",
"Text=\"code\":0",
LAST);
web_custom_request("check",
"URL=http://***/***/check",
"Method=GET",
"Resource=0",
"Referer=0",
"Mode=HTML",
LAST);
lr_end_transaction("check", LR_AUTO);
return 0;
}
LoadRunner测试http接口代码
最新推荐文章于 2021-07-25 11:38:48 发布