|
本人是个新手,想要执行50个不同的用户同时进行登陆测试,参数选择为unique和each interation,迭代次数选择1,参数列表中已经输入了50个用户名和密码,代码如下:
我现在有几个问题不太明白:
1)想要测试50个用户并发登陆,按照下面的代码是否可以实现呢?
2)如果能够实现,为什么在日志中用户名和密码不显示呢?这些在日志中能够看到吗?
3)如果不可以实现,我需要怎么修改呢?
lr_think_time(15);
web_url("Dv_GetCode.asp",
"URL=http://localhost/rencailuntan/Dv_GetCode.asp?t=0.8430000212330779",
"Resource=1",
"RecContentType=image/bmp",
"Referer=http://localhost/rencailuntan/index.asp",
"Snapshot=t3.inf",
LAST);
web_url("ajax_check.asp",
"URL=http://localhost/rencailuntan/ajax_check.asp?rs=checke_dvcode&rsargs[]=checke_dvcode&rsargs[]=codestr&rsargs[]=0731&rsrnd=1241428205171",
"Resource=0",
"RecContentType=text/html",
"Referer=http://localhost/rencailuntan/index.asp",
"Snapshot=t4.inf",
"Mode=HTML",
EXTRARES,
"URL=images/button_bg2.gif", "Referer=http://localhost/rencailuntan/index.asp", ENDITEM,
LAST);
lr_think_time(17);
web_url("button_bg2.gif",
"URL=http://localhost/rencailuntan/images/button_bg2.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://localhost/rencailuntan/index.asp",
"Snapshot=t5.inf",
LAST);
lr_start_transaction("userstartdenglu");
trans_time=lr_get_transaction_duration( "userstartdenglu" );
//lr_get_transaction_duration这个函数可以得到事务执行所消耗的时间
web_reg_find("Text=已经登陆","SaveCount=num","Search=body",LAST);
lr_rendezvous("denglurenshu");//插入集合点
web_submit_data("login.asp",
"Action=http://localhost/rencailuntan/login.asp?action=chk",
"Method=POST",
"RecContentType=text/html",
"Referer=http://localhost/rencailuntan/index.asp",
"Snapshot=t6.inf",
"Mode=HTML",
ITEMDATA,
"Name=username", "Value={username}", ENDITEM,
"Name=password", "Value={password}", ENDITEM,
"Name=submit", "Value= 登 录 ", ENDITEM,
LAST);
web_custom_request("activeonline.asp_2",
"URL=http://localhost/rencailuntan/activeonline.asp",
"Method=POST",
"Resource=0",
"RecContentType=text/html",
"Referer=http://localhost/rencailuntan/index.asp",
"Snapshot=t7.inf",
"Mode=HTML",
"Body=state=%u6B22%u8FCE%u8BBF%u95EE%5B%u5C31%u4E1A%u670D%u52A1%5D&boardid=0",
LAST);
lr_end_transaction("userstartdenglu", LR_AUTO);
lr_log_message("使用参数值: %s", lr_eval_string("{username}"));
lr_log_message("使用密码: %s", lr_eval_string("{password}"));
if (strcmp(lr_eval_string("{num}"),"0")==0)
lr_log_message("登录失败!");
else
lr_log_message("登录成功!"); |
|