|
用loadrunner录制了51testing的登录操作,未参数化的脚本并且对用户是否登录成功进行判断:
web_reg_find("text=test001","SaveCount=test001_Count",LAST);web_submit_data("logging.php",
"Action=http://bbs.51testing.com/logging.php?action=login&loginsubmit=true",
"Method=POST",
"RecContentType=text/html",
"Referer=http://bbs.51testing.com/default.php",
"Snapshot=t5.inf",
"Mode=HTML",
ITEMDATA,
"Name=formhash", "Value=8e7821ab", ENDITEM,
"Name=cookietime", "Value=2592000", ENDITEM,
"Name=loginfield", "Value=username", ENDITEM,
"Name=username", "Value=test001", ENDITEM,
"Name=password", "Value=test001", ENDITEM,
"Name=userlogin", "Value=?", ENDITEM,
LAST);
IF (atoi(lr_eval_string("test001_Count"))>0)
{ lr_output_message("log on successful.")}
else
{ lr_output_message("log on failed");
return(0);
}
现在将红色字体对应的用户名和密码进行参数化:
web_reg_find("text={username}","SaveCount={username}_Count",LAST);
web_submit_data("logging.php",
"Action=http://bbs.51testing.com/logging.php?action=login&loginsubmit=true",
"Method=POST",
"RecContentType=text/html",
"Referer=http://bbs.51testing.com/default.php",
"Snapshot=t5.inf",
"Mode=HTML",
ITEMDATA,
"Name=formhash", "Value=8e7821ab", ENDITEM,
"Name=cookietime", "Value=2592000", ENDITEM,
"Name=loginfield", "Value=username", ENDITEM,
"Name=username", "Value={username}", ENDITEM,
"Name=password", "Value={password}", ENDITEM,
"Name=userlogin", "Value=?", ENDITEM,
LAST);
if (atoi(lr_eval_string("{{username}_Count}"))>0)
{ lr_output_message("username log on successful:",lr_eval_string("{username}"));
}
else
{ lr_error_message("username log on faile:",lr_eval_string("{username}"));
return (0);
}
大家帮我看下,我这样参数化对不对,运行结果中显示能登录进去,但是录制日志中显示的是log on failed,参数化是不是有问题?
[ 本帖最后由 yawenhui 于 2009-3-26 13:35 编辑 ] |
|