一、微信小程序接口文档:
访问域名:https://××.cn/api
接口地址:/miniprogram/××/add_wechat_member
请求方式:post
数据格式:json
需要在header中添加Authorization值(固定值)
需要走内网,配hosts(公网VIP或者内网VIP),可以配完后ping一下域名,看是否可以ping通
字段 | 参数值 | 备注 |
openid | Zqxmp_openid_test_001 | 最后尾数自增到并发值 |
nickname | Zqxmp_nickname_001 | 最后尾数自增到并发值 |
object_openid | 固定值,6 |
|
二、loadrunner脚本
Action()
{
web_reg_find("Text=0",
"Fail=NotFound",
"SaveCount=code",
"Search=Body",
LAST);
//集合点
lr_rendezvous("jihe");
lr_start_transaction("tianjiafangke");
web_add_header("Content-Type",
"application/json");
web_add_header("Authorization",
"bearer ××");
web_submit_data("web_submit_data",
"Action=https://××.cn/api/miniprogram/××/add_wechat_member",
"Method=POST",
"TargetFrame=",
"Referer=",
ITEMDATA,
"Name=openid", "Value={NewParam}", ENDITEM,
"Name=nickname", "Value={nickname}", ENDITEM,
"Name=object_openid", "Value=6", ENDITEM,
LAST);
if(atoi(lr_eval_string("{code}"))>=1){
lr_end_transaction("tianjiafangke", LR_PASS);
}else{
lr_end_transaction("tianjiafangke", LR_AUTO);
}
return 0;
}
三、HTTPS要注意使用Winlnet replay instead of Sockets(windows only)回放(在runtime-settings中设置)
否则回放会报错 ,可查看https://blog.csdn.net/mao_xiaoxi/article/details/89634254