51Testing软件测试论坛

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

作者: power-JG    时间: 2015-1-5 14:53
标题: 用LR录制自带订票系统的网站的登录模块做了一个文本检查点SaveCount的值总是为0
用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.
作者: testingstudying    时间: 2015-8-14 09:04
应该是回放就失败,即没有登录成功,因为session都没有做关联




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2