在学习LoadRunner添加检查点函数时,遇到下面的报错
Action.c(135): Error -26366: "Text=checkString" not found for web_reg_find [MsgId: MERR-26366]
Action.c(135): web_concurrent_end highest severity level was "ERROR", 2354 body bytes, 478 header bytes [MsgId: MMSG-26388]
出现原因是检查点函数位置写的不对。在LoadRunner中,含有reg的函数可以称为注册函数,这种类型函数的特点是在使用时,要放在实际请求提交之前。
初始录制脚本为:
web_submit_data("login.pl",
"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=t9.inf",
"Mode=HTTP",
ITEMDATA,
"Name=userSession", "Value=126807.596597813zfcczzfpHfDQVDfpQQtf", ENDITEM,
"Name=username", "Value=test1", ENDITEM,
"Name=password", "Value=111111", ENDITEM,
"Name=JSFormSubmit", "Value=off", ENDITEM,
"Name=login.x", "Value=36", ENDITEM,
"Name=login.y", "Value=5", ENDITEM,
LAST);
web_url("login.pl_2",
"URL=http://127.0.0.1:1080/WebTours/login.pl?intro=true",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/login.pl",
"Snapshot=t15.inf",
"Mode=HTTP",
LAST);
web_reg_find("Text=test1",LAST);
此时,因为检查点函数放在请求提交之后,所以回放时出现上面提到的报错。修改脚本如下:
web_reg_find("Text=test1",LAST);
web_submit_data("login.pl",
"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=t9.inf",
"Mode=HTTP",
ITEMDATA,
"Name=userSession", "Value=126807.596597813zfcczzfpHfDQVDfpQQtf", ENDITEM,
"Name=username", "Value=test1", ENDITEM,
"Name=password", "Value=111111", ENDITEM,
"Name=JSFormSubmit", "Value=off", ENDITEM,
"Name=login.x", "Value=36", ENDITEM,
"Name=login.y", "Value=5", ENDITEM,
LAST);
web_url("login.pl_2",
"URL=http://127.0.0.1:1080/WebTours/login.pl?intro=true",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/login.pl",
"Snapshot=t15.inf",
"Mode=HTTP",
LAST);
运行修改后的脚本,显示成功信息。
Action.c(95): Registering web_reg_find was successful [MsgId: MMSG-26390]