引言
本次实践的项目是昭通APP。
正文
1、录制协议选择
录制协议选择WEB/HTTP。
2、录制选项设置
如下图所示:
1)Application type:Win32 Application (录制客户端的选择);
2)Program to record:D:\Program Files\LoadRunner\bin\wplus_init_wsock.exe(wplus_init_wsock.exe文件路径地址)
Recording Options设置说明:
1)Port Mapping:Capture level选择Socket level data
2)点击New Entry,进入Server Entry设置,如下图所示:
Server Entry设置说明:
1)Target Server:192.168.5.131(APP服务端的IP),Port:8784(APP服务端的端口),Server ID:HTTP(协议),如本次部署昭通APP服务端的地址:192.168.5.131:8784/mmall(tomcat地址);
2)Traffic fowarding:2018(代理端口,未被暂用的端口即可)。
3、手机网络代理设置
如下图所示:
手机网络代理设置说明:
1)代理服务器主机名:192.168.191.1(本机的IP),可通过以下方法查询:
直接随便录制跑下,LR会显示如下内容,而此处的dragon-PC的IP即是代理服务器主机名:
2)代理服务器端口:2018(与LR设置的代理端口一致)
附录(昭通APP登录的脚本):
Action()
{
lr_start_transaction("登录");
web_reg_save_param("logincheck",
"LB=\"msg\":\"",
"RB=\"",
"ORD=1",
LAST);
web_submit_data("login.do",
"Action=http://192.168.5.131:8784/mmall/user/login.do",
"Method=POST",
"TargetFrame=",
"RecContentType=application/json",
"Referer=",
"Snapshot=t20.inf",
"Mode=HTML",
ITEMDATA,
"Name=password", "Value=123456", ENDITEM,
"Name=username", "Value=zhaotong2", ENDITEM,
LAST);
//lr_convert_string_encoding字符串编码转换
lr_convert_string_encoding(lr_eval_string("{logincheck}"),
LR_ENC_UTF8,
LR_ENC_SYSTEM_LOCALE,
"loginmsg" );
lr_output_message(lr_eval_string("{loginmsg}"));
lr_end_transaction("登录",LR_AUTO);
lr_start_transaction("临控待办统计");
web_submit_data("lkyjcount.do",
"Action=http://192.168.5.131:8784/mmall/user/lkyjcount.do",
"Method=POST",
"TargetFrame=",
"RecContentType=application/json",
"Referer=",
"Snapshot=t21.inf",
"Mode=HTML",
ITEMDATA,
"Name=deptName", "Value=昭通市公安局", ENDITEM,
"Name=deptNo", "Value=530600000000", ENDITEM,
"Name=deptTel", "Value=", ENDITEM,
"Name=realName", "Value=郝晓倩", ENDITEM,
"Name=sfzh", "Value=640422196610295843", ENDITEM,
"Name=tel", "Value=15980972015", ENDITEM,
"Name=userId", "Value=ff80808160c2f0ce0161de81a5a80f68", ENDITEM,
"Name=userName", "Value=zhaotong2", ENDITEM,
LAST);
lr_end_transaction("临控待办统计",LR_AUTO);
lr_start_transaction("常控待办统计");
web_submit_data("ckyjcount.do",
"Action=http://192.168.5.131:8784/mmall/user/ckyjcount.do",
"Method=POST",
"TargetFrame=",
"RecContentType=application/json",
"Referer=",
"Snapshot=t22.inf",
"Mode=HTML",
ITEMDATA,
"Name=deptName", "Value=昭通市公安局", ENDITEM,
"Name=deptNo", "Value=530600000000", ENDITEM,
"Name=deptTel", "Value=", ENDITEM,
"Name=realName", "Value=郝晓倩", ENDITEM,
"Name=sfzh", "Value=640422196610295843", ENDITEM,
"Name=tel", "Value=15980972015", ENDITEM,
"Name=userId", "Value=ff80808160c2f0ce0161de81a5a80f68", ENDITEM,
"Name=userName", "Value=zhaotong2", ENDITEM,
LAST);
lr_end_transaction("常控待办统计",LR_AUTO);
return 0;
}