51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

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

[求助] 录制登陆脚本跟踪事务状态

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2012-6-18 15:50:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 ken19850 于 2012-6-18 16:00 编辑

脚本代码如下
Action()
{
        double trans_time;
        int status;
        web_url("WebTours",
                "URL=http://127.0.0.1:1080/WebTours",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTML",
                LAST);
        lr_start_transaction("tr_login");
        trans_time=lr_get_transaction_duration("tr_login");
        web_reg_find("text=error","savecount=login_count",LAST);
                                                          
        lr_think_time(6);

        status = web_submit_data("login.pl",
                "Action=http://127.0.0.1:1080/WebTours/login.pl",
                "Method=POST",
                "TargetFrame=body",
                "RecContentType=text/html",
                "Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
                "Snapshot=t2.inf",
                "Mode=HTML",
                ITEMDATA,
                "Name=userSession", "Value=108546.289428919ffiDDtQpHzcfDDfAApAQifHf", ENDITEM,
                "Name=username", "Value={name}", ENDITEM,
                "Name=password", "Value={key}", ENDITEM,
                "Name=JSFormSubmit", "Value=off", ENDITEM,
                "Name=login.x", "Value=77", ENDITEM,
                "Name=login.y", "Value=11", ENDITEM,
                LAST);

        if(status ==0)
                lr_end_transaction("tr_login",LR_PASS);
        else
                lr_end_transaction("tr_login",LR_FAIL);

        if(trans_time)
                lr_output_message("事务耗时%f秒",trans_time);
        else
                lr_output_message("时间不确定");

        if(atoi(lr_eval_string("{login_count"))>0)
       
                lr_error_message("failed");
        else{
                        lr_output_message("successful");
                        return(0);
                }
       

        lr_think_time(4);

        web_url("SignOff Button",
                "URL=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1",
                "TargetFrame=body",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home",
                "Snapshot=t3.inf",
                "Mode=HTML",
                LAST);

        return 0;
}

日志如下
Virtual User Script started at : 2012-06-18 15:40:52
Starting action vuser_init.
Web Turbo Replay of LoadRunner 11.0.0 for WINXP; build 8859 (Aug 18 2010 20:14:31)          [MsgId: MMSG-27143]
Run Mode: HTML          [MsgId: MMSG-26000]
Run-Time Settings file: "E:\loadrunner 11脚本\web tours\\default.cfg"          [MsgId: MMSG-27141]
Ending action vuser_init.
Running Vuser...
Starting iteration 1.
Starting action Action.
Action.c(7): Redirecting "http://127.0.0.1:1080/WebTours" (redirection depth is 0)          [MsgId: MMSG-26694]
Action.c(7): To location "http://127.0.0.1:1080/WebTours/"          [MsgId: MMSG-26693]
Action.c(7): 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(7): 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(7): 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(7): 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(7): web_url("WebTours") was successful, 6449 body bytes, 1724 header bytes          [MsgId: MMSG-26386]
Action.c(17): Notify: Transaction "tr_login" started.
Action.c(19): Registering web_reg_find was successful          [MsgId: MMSG-26390]
Action.c(23): Registered web_reg_find successful for "Text=error"          [MsgId: MMSG-26362]
Action.c(23): web_submit_data("login.pl") was successful, 795 body bytes, 225 header bytes          [MsgId: MMSG-26386]
Action.c(41): Notify: Transaction "tr_login" ended with "Pass" status (Duration: 0.2820 Wasted Time: 0.0014).
Action.c(46): 事务耗时0.007232秒
Action.c(54): successful
Action.c(61): 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=1"          [MsgId: MMSG-26574]
Action.c(61): Detected non-resource "http://127.0.0.1:1080/WebTours/home.html" in "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1"          [MsgId: MMSG-26574]
Action.c(61): Retrieving data from cache for "http://127.0.0.1:1080/WebTours/home.html"          [MsgId: MMSG-26558]
Action.c(61): Resource "http://127.0.0.1:1080/WebTours/images/mer_login.gif" is in the cache already and will not be downloaded again          [MsgId: MMSG-26655]
Action.c(61): web_url("SignOff Button") was successful, 2019 body bytes, 577 header bytes          [MsgId: MMSG-26386]
Ending action Action.
Ending iteration 1.
Starting iteration 2.
Starting action Action.
Action.c(7): Redirecting "http://127.0.0.1:1080/WebTours" (redirection depth is 0)          [MsgId: MMSG-26694]
Action.c(7): To location "http://127.0.0.1:1080/WebTours/"          [MsgId: MMSG-26693]
Action.c(7): 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(7): 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(7): 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(7): 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(7): web_url("WebTours") was successful, 6443 body bytes, 1724 header bytes          [MsgId: MMSG-26386]
Action.c(17): Notify: Transaction "tr_login" started.
Action.c(19): Registering web_reg_find was successful          [MsgId: MMSG-26390]
Action.c(23): Registered web_reg_find successful for "Text=error"          [MsgId: MMSG-26362]
Action.c(23): web_submit_data("login.pl") was successful, 795 body bytes, 225 header bytes          [MsgId: MMSG-26386]
Action.c(41): Notify: Transaction "tr_login" ended with "Pass" status (Duration: 0.5122 Wasted Time: 0.0015).
Action.c(46): 事务耗时0.019739秒
Action.c(54): successful
Action.c(61): 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=1"          [MsgId: MMSG-26574]
Action.c(61): Detected non-resource "http://127.0.0.1:1080/WebTours/home.html" in "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1"          [MsgId: MMSG-26574]
Action.c(61): Retrieving data from cache for "http://127.0.0.1:1080/WebTours/home.html"          [MsgId: MMSG-26558]
Action.c(61): Resource "http://127.0.0.1:1080/WebTours/images/mer_login.gif" is in the cache already and will not be downloaded again          [MsgId: MMSG-26655]
Action.c(61): web_url("SignOff Button") was successful, 2023 body bytes, 577 header bytes          [MsgId: MMSG-26386]
Ending action Action.
Ending iteration 2.
Starting iteration 3.
Starting action Action.
Action.c(7): Redirecting "http://127.0.0.1:1080/WebTours" (redirection depth is 0)          [MsgId: MMSG-26694]
Action.c(7): To location "http://127.0.0.1:1080/WebTours/"          [MsgId: MMSG-26693]
Action.c(7): 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(7): 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(7): 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(7): 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(7): web_url("WebTours") was successful, 6447 body bytes, 1724 header bytes          [MsgId: MMSG-26386]
Action.c(17): Notify: Transaction "tr_login" started.
Action.c(19): Registering web_reg_find was successful          [MsgId: MMSG-26390]
Action.c(23): Registered web_reg_find successful for "Text=error"          [MsgId: MMSG-26362]
Action.c(23): web_submit_data("login.pl") was successful, 795 body bytes, 225 header bytes          [MsgId: MMSG-26386]
Action.c(41): Notify: Transaction "tr_login" ended with "Pass" status (Duration: 0.3111 Wasted Time: 0.0010).
Action.c(46): 事务耗时0.019568秒
Action.c(54): successful
Action.c(61): 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=1"          [MsgId: MMSG-26574]
Action.c(61): Detected non-resource "http://127.0.0.1:1080/WebTours/home.html" in "http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1"          [MsgId: MMSG-26574]
Action.c(61): Retrieving data from cache for "http://127.0.0.1:1080/WebTours/home.html"          [MsgId: MMSG-26558]
Action.c(61): Resource "http://127.0.0.1:1080/WebTours/images/mer_login.gif" is in the cache already and will not be downloaded again          [MsgId: MMSG-26655]
Action.c(61): web_url("SignOff Button") was successful, 2021 body bytes, 577 header bytes          [MsgId: MMSG-26386]
Ending action Action.
Ending iteration 3.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.

我的对用户名和密码参数化时三个中间的那个是错误的
但是不知道为什么日志说都是通过的!
求真相!
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2012-6-18 15:59:36 | 只看该作者
请看手工事务状态控制
回复 支持 反对

使用道具 举报

本版积分规则

关闭

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

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

GMT+8, 2024-11-15 05:46 , Processed in 0.085854 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

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