LoadRunner正确的登录压力测试方法实战

x33g5p2x  于2021-12-07 转载在 其他  
字(1.1k)|赞(0)|评价(0)|浏览(153)

大部分的人,只会录登录逻辑,直接上代码,代码如下:

Action()
{
 lr_think_time(12);

 //添加登录时的集合点Login
 lr_rendezvous("login");

 //设置开始事务
 lr_start_transaction("login");
 //获取验证码
 web_url("code",
  "URL=http://<url>/code.do",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=",
  "Mode=HTML",
  LAST);

 //登录
 web_submit_data("login",
	"Action=http://<url>/login.do",
	"Method=POST",
	"RecContentType=text/xml",
	"Referer=http://<url>/index.do",
	"Mode=HTML",
	ITEMDATA,
	"Name=inputcode", "Value=user1",ENDITEM,
	"Name=loginname", "Value=user1",ENDITEM,
	"Name=password", "Value=user1234",ENDITEM,
	LAST);
 //停5秒
 lr_think_time(5);
 //点击订单管理页面
 web_url("order",
  "URL=http://<url>/order/list.do",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=",
  "Mode=HTML",
  LAST);

 //设置结束事务
 lr_end_transaction("login", LR_AUTO);
 

    return 0;
}

其中<url>是变量,不同系统的参数有所不同。

完整项目,请见LoadRunner正确的登录压力测试方法实战,完整的LoadRunner脚本

相关文章

微信公众号

最新文章

更多