51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

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

[原创] 用LR录制自带订票系统的网站的登录模块做了一个文本检查点SaveCount的值总是为0

[复制链接]
  • TA的每日心情
    慵懒
    2015-1-7 09:45
  • 签到天数: 3 天

    连续签到: 3 天

    [LV.2]测试排长

    跳转到指定楼层
    1#
    发表于 2015-1-5 14:53:07 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    用LR录制自带订票系统的网站的登录模块做了一个文本检查点web_reg_find()函数中SaveCount的值总是为0?求解。
    vuser_init()
    {
      web_url("WebTours",
                    "URL={URL}WebTours/",
                    "Resource=0",
                    "RecContentType=text/html",
                    "Referer=",
                    "Snapshot=t24.inf",
                    "Mode=HTML",
                    LAST);

            web_reg_find("Text=Welcome,piaoxu",
                    "SaveCount=Welcome_Count",
                    "Search=Body",
                    LAST);

            web_submit_data("login.pl",
                    "Action={URL}WebTours/login.pl",
                    "Method=POST",
                    "RecContentType=text/html",
                    "Referer={URL}WebTours/nav.pl?in=home",
                    "Snapshot=t27.inf",
                    "Mode=HTML",
                    ITEMDATA,
                    "Name=userSession", "Value=115054.858566221fQViVDtpciHfDffAipiAfHcf", ENDITEM,
                    "Name=username", "Value=piaoxu", ENDITEM,
                    "Name=password", "Value=512684234", ENDITEM,
                    "Name=JSFormSubmit", "Value=off", ENDITEM,
                    "Name=login.x", "Value=29", ENDITEM,
                    "Name=login.y", "Value=6", ENDITEM,
                    LAST);

        lr_output_message("%s ", lr_eval_string("{Welcome_Count}"));

           
            if(atoi(lr_eval_string("{Welcome_Count}")) > 0){

            lr_output_message("--------------登录成功!------------");

            }

            else {

            lr_error_message("---------------登录失败!------------");
            }

           
    return 0;
    }

    //lr_output_message("%d",Welcome_Count);

            /*
        web_reg_find("Text=ABC", "SaveCount=abc_count", LAST );

        web_url("Step", "URL=...", LAST );

        if (strcmp(lr_eval_string("{abc_count}"), "0") == 0) 没有找到,则执行A;找到则执行B

        Action A

        else

        Action B


        if(strcmp(lr_eval_string("{Welcome_Count}"),lr_eval_string("0")) == 0) {

            lr_error_message("-----------------Login Fail!----------------");

            }

            else{
           
            lr_output_message("***********Login Successful!**********");
       }


    日志:
    Virtual User Script started at : 2015-01-05 11:18:10
    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: "D:\LRJB\bookticket\\default.cfg"          [MsgId: MMSG-27141]
    vuser_init.c(13): Detected non-resource "http://127.0.0.1:1080/WebTours/header.html" in "http://127.0.0.1:1080/WebTours/"          [MsgId: MMSG-26574]
    vuser_init.c(13): 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]
    vuser_init.c(13): 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]
    vuser_init.c(13): 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]
    vuser_init.c(13): 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]
    vuser_init.c(13): 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]
    vuser_init.c(13): 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]
    vuser_init.c(13): web_url("WebTours") was successful, 6448 body bytes, 1562 header bytes          [MsgId: MMSG-26386]
    vuser_init.c(22): Registering web_reg_find was successful          [MsgId: MMSG-26390]
    vuser_init.c(27): Registered web_reg_find successful for "Text=Welcome,piaoxu"          [MsgId: MMSG-26362]
    vuser_init.c(27): web_submit_data("login.pl") was successful, 795 body bytes, 225 header bytes          [MsgId: MMSG-26386]
    vuser_init.c(43): 0
    vuser_init.c(54): Error: ---------------登录失败!------------
    Ending action vuser_init.
    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    2015-10-30 19:48
  • 签到天数: 18 天

    连续签到: 1 天

    [LV.4]测试营长

    2#
    发表于 2015-8-14 09:04:29 | 只看该作者
    应该是回放就失败,即没有登录成功,因为session都没有做关联
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

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

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

    GMT+8, 2024-5-2 09:18 , Processed in 0.064970 second(s), 22 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

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