案例:
测试公积金的项目,要求汇缴核定与汇补缴办理查询与并发测试。指标项为60-100,涉及多个接口。
测试工具:loadrunner11
测试方法:通过业务流程,录制脚本,依据业务调试脚本,确认respsone 与request 均成功, 同时通过httpView查看参数化与数据的获取,还修改脚本。
如init时的登录脚本:
vuser_init()
{
web_url("login2.jsp",
"URL=http://101.102.31.6:50105/portal/login2.jsp",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t4.inf",
"Mode=HTML",
EXTRARES,
"Url=images/btn-blue.jpg", ENDITEM,
"Url=images/key.png", ENDITEM,
"Url=images/admin.png", ENDITEM,
"Url=images/login-bg01.jpg", ENDITEM,
LAST);
lr_think_time(11);
web_submit_data("newlogin.ajax",
"Action=http://101.102.31.6:50105/portal/platform/admin/user/newlogin.ajax",
"Method=POST",
"TargetFrame=",
"RecContentType=application/json",
"Referer=http://101.102.31.6:50105/portal/login2.jsp",
"Snapshot=t5.inf",
"Mode=HTML",
ITEMDATA,
"Name=account", "Value=gj01", ENDITEM, //ceshiguimian2
"Name=password", "Value=gj01", ENDITEM, //2
LAST);
web_url("index.jsp",
"URL=http://101.102.31.6:50105/portal/pages/index.jsp",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=http://101.102.31.6:50105/portal/login2.jsp",
"Snapshot=t6.inf",
"Mode=HTML",
LAST);
//增加web_reg_save_param_ex函数,通过回放确认参数的边界,获取动态数据。
web_reg_save_param_ex(
"ParamName=TokenID",
"LB/IC=signature=",
"RB/IC=\"",
LAST);
web_submit_data("ssoServer.jsp",
"Action=http://101.102.31.6:50105/portal/pages/sso/ssoServer.jsp?APPID=GJ",
"Method=POST",
"TargetFrame=",
"RecContentType=text/html",
"Referer=",
"Snapshot=t7.inf",
"Mode=HTML",
ITEMDATA,
EXTRARES,
// "Url=https://gj.gjj.sh.cegn.cn:50101/project/js/calendar/skin/WdatePicker.css", "Referer=https://gj.gjj.sh.cegn.cn:50101/project/manage/index.shtml?j_token_signature=Y2VzaGlndWltaWFuMjoxNTQ4ODM2MjI1MjA4OjZiYzYzZTc0OGU5NDY5YzQxNGJkZDA4MzAzMGY0OTBj", ENDITEM,
LAST);
//打印TokenID信息
lr_output_message("Return value = %s.", lr_eval_string( "{TokenID}" ) );
web_custom_request("left.shtml",
"URL=https://gj.gjj.sh.cegn.cn:50101/project/manage/left.shtml?resourceId=2040",
"Method=POST",
"TargetFrame=",
"Resource=0",
"RecContentType=text/html",
"Referer=https://gj.gjj.sh.cegn.cn:50101/project/manage/index.shtml?j_token_signature={TokenID}",//Y2VzaGlndWltaWFuMjoxNTQ4ODM2MjI1MjA4OjZiYzYzZTc0OGU5NDY5YzQxNGJ