|
脚本:
Action()
{
web_url("WebTours",
"URL=http://127.0.0.1:1080/WebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
/*web_link("sign up now",
"Text=sign up now",
"Snapshot=t2.inf",
LAST);
*/
//lr_think_time(18);
/*web_submit_form("login.pl",
"Snapshot=t3.inf",
ITEMDATA,
"Name=username", "Value={username}", ENDITEM,
"Name=password", "Value={password}", ENDITEM,
"Name=passwordConfirm", "Value={password}", ENDITEM,
"Name=firstName", "Value={firstname}", ENDITEM,
"Name=lastName", "Value={lastname}", ENDITEM,
"Name=address1", "Value={address1}", ENDITEM,
"Name=address2", "Value={address2}", ENDITEM,
"Name=register.x", "Value=43", ENDITEM,
"Name=register.y", "Value=12", ENDITEM,
LAST);
*/
//lr_think_time(12);
//对usersession设置关联
web_reg_save_param("userSession",
"LB=name=userSession value=",
"RB=>",
"Ord=1",
"Search=Body",
LAST);
//设置检查点,检查welcome
web_reg_find("Search=Body",
"SaveCount=sscount",
"Text=Welcome",
LAST);
//登陆,提交信息
web_submit_data("login.pl_2",
"Action=http://127.0.0.1:1080/WebTours/login.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
"Snapshot=t4.inf",
"Mode=HTML",
ITEMDATA,
"Name=userSession", "Value={userSession}", ENDITEM,
"Name=username", "Value={username}", ENDITEM,
"Name=password", "Value={password}", ENDITEM,
"Name=JSFormSubmit", "Value=off", ENDITEM,
"Name=login.x", "Value=49", ENDITEM,
"Name=login.y", "Value=7", ENDITEM,
LAST);
web_set_max_html_param_len("3348");
//打印关联到的user Session
lr_output_message("userSession: %s", lr_eval_string("{userSession}"));
/*web_image("Home Button",
"Alt=Home Button",
"Snapshot=t5.inf",
LAST);
*/
/*web_image("SignOff Button",
"Alt=SignOff Button",
"Ordinal=1",
"Snapshot=t6.inf",
LAST);
*/
//输出检查点出现的次数
if(atoi(lr_eval_string("{sscount}"))>0)
{
lr_output_message("Welcome出现的次数是:%s", lr_eval_string("{sscount}"));
}
else
{
lr_output_message("未发现检查点,登录失败");
}
return 0;
}
设置10次迭代
replay log(其中一个):
Virtual User Script started at : 2016-07-13 12:20:52
Starting action vuser_init.
Web Turbo Replay of LoadRunner 11.0.0 for Windows 7; build 8859 (Aug 18 2010 20:14:31) [MsgId: MMSG-27143]
Run Mode: HTML [MsgId: MMSG-26000]
Run-Time Settings file: "C:\Users\mj\Desktop\zhuce2\\default.cfg" [MsgId: MMSG-27141]
Ending action vuser_init.
Running Vuser...
Starting iteration 1.
Starting action Action.
Action.c(5): Detected non-resource "http://127.0.0.1:1080/WebTours/header.html" in "http://127.0.0.1:1080/WebTours/" [MsgId: MMSG-26574]
Action.c(5): Detected non-resource "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true" in "http://127.0.0.1:1080/WebTours/" [MsgId: MMSG-26574]
Action.c(5): Found resource "http://127.0.0.1:1080/WebTours/images/hp_logo.png" in HTML "http://127.0.0.1:1080/WebTours/header.html" [MsgId: MMSG-26659]
Action.c(5): Found resource "http://127.0.0.1:1080/WebTours/images/webtours.png" in HTML "http://127.0.0.1:1080/WebTours/header.html" [MsgId: MMSG-26659]
Action.c(5): Detected non-resource "http://127.0.0.1:1080/WebTours/nav.pl?in=home" in "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true" [MsgId: MMSG-26574]
Action.c(5): Detected non-resource "http://127.0.0.1:1080/WebTours/home.html" in "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true" [MsgId: MMSG-26574]
Action.c(5): Found resource "http://127.0.0.1:1080/WebTours/images/mer_login.gif" in HTML "http://127.0.0.1:1080/WebTours/nav.pl?in=home" [MsgId: MMSG-26659]
Action.c(5): web_url("WebTours") was successful, 6446 body bytes, 1562 header bytes [MsgId: MMSG-26386]
Action.c(38): Registering web_reg_save_param was successful [MsgId: MMSG-26390]
Action.c(46): Registering web_reg_find was successful [MsgId: MMSG-26390]
Action.c(52): Warning: The string 'userSession' with parameter delimiters is not a parameter.
Action.c(52): Notify: Parameter Substitution: parameter "username" = "mj1"
Action.c(52): Notify: Parameter Substitution: parameter "password" = "mj1"
Action.c(52): Continuing after Error -26377: No match found for the requested parameter "userSession". Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 256 bytes, use web_set_max_html_param_len to increase the parameter size [MsgId: MERR-26377]
Action.c(52): Notify: Saving Parameter "userSession = ".
Action.c(52): Registered web_reg_find successful for "Text=Welcome" [MsgId: MMSG-26362]
Action.c(52): Notify: Saving Parameter "sscount = 0".
Action.c(52): web_submit_data("login.pl_2") highest severity level was "continue on error", 795 body bytes, 225 header bytes [MsgId: MMSG-26388]
Action.c(52): Continuing after error in Vuser script.
Action.c(68): web_set_max_html_param_len was successful [MsgId: MMSG-26392]
Action.c(71): Notify: Parameter Substitution: parameter "userSession" = ""
Action.c(71): userSession:
Action.c(87): Notify: Parameter Substitution: parameter "sscount" = "0"
Action.c(93): 未发现检查点,登录失败
Ending action Action.
Ending iteration 1.
请问大神们,我要怎么才能解决呢? |
|