51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 1425|回复: 1
打印 上一主题 下一主题

[求助] loadrunner录制webtours登录脚本,回放脚本总出错

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2016-7-13 16:39:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
脚本:
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.


请问大神们,我要怎么才能解决呢?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

  • TA的每日心情
    奋斗
    11 小时前
  • 签到天数: 2821 天

    连续签到: 3 天

    [LV.Master]测试大本营

    2#
    发表于 2016-7-14 15:26:58 | 只看该作者
    关联的userSession没关联上,自己一遍遍试试,看看值到底是什么

    评分

    参与人数 1测试积点 +10 收起 理由
    lsekfe + 10 积极回复获得测试积点10

    查看全部评分

    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-11-27 20:12 , Processed in 0.061556 second(s), 26 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表