51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2358|回复: 12
打印 上一主题 下一主题

[原创] Controller使用多个错误输出时为什么只输出第一个?

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2007-4-20 13:52:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
在脚本中连续使用了多次web_reg_find和lr_error_message,但是在Controller运行的时候,在Errors Output窗口中只显示了第一条错误内容,对于其他的错误信息根本没有显示。即在Sample Message Text列中只显示出: Action.c(52): Error: 发现北京。
     但是选择某个Vuser的日志打开后,可以显示出其他的错误信息。
      这一般是什么原因造成的啊?
     以下是部分脚本

Action()
{
    web_reg_find("Text=北京",
        "SaveCount=BeiJing_Count",
        LAST);
        
    web_reg_find("Text=上海",
        "SaveCount=ShangHai_Count",
        LAST);
        
    web_reg_find("Text=重庆",
        "SaveCount=ChongQing_Count",
        LAST);
     
    ............................
    ............................
   
    if (atoi(lr_eval_string("{BeiJing_Count}")) > 0)
        lr_error_message("发现北京");
        
    if (atoi(lr_eval_string("{ShangHai_Count}")) > 0)
        lr_error_message("发现上海");
        
    if (atoi(lr_eval_string("{ChongQing_Count}")) > 0)
        lr_error_message("发现重庆");
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2007-4-20 15:05:54 | 只看该作者
晕~   沉的这么快啊
回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2007-4-20 15:36:57 | 只看该作者
求助啊

而且continue on error已经被选上了
回复 支持 反对

使用道具 举报

该用户从未签到

4#
发表于 2007-4-20 15:59:02 | 只看该作者
count应该用小写的。

你这样写吧:

    web_reg_find("Text=北京",
        "SaveCount=BeiJing_count",
        LAST);
        
    web_reg_find("Text=上海",
        "SaveCount=ShangHai_count",
        LAST);
        
    web_reg_find("Text=重庆",
        "SaveCount=ChongQing_count",
        LAST);
     
    ............................
    ............................
   
    if (atoi(lr_eval_string("{BeiJing_count}")) > 0)
        lr_error_message("发现北京");
        
    if (atoi(lr_eval_string("{ShangHai_count}")) > 0)
        lr_error_message("发现上海");
        
    if (atoi(lr_eval_string("{ChongQing_count}")) > 0)
        lr_error_message("发现重庆");

[ 本帖最后由 Zee 于 2007-4-20 16:08 编辑 ]
回复 支持 反对

使用道具 举报

该用户从未签到

5#
 楼主| 发表于 2007-4-20 16:10:27 | 只看该作者
改成下面这个样子了,还是不行,错误输出中只有("发现北京!") 而没有 ("发现北!")

Action()
{
    web_reg_find("Text=北京",
        "Savecount=beijing",
        LAST);

    web_reg_find("Text=北",
        "Savecount=bei",
        LAST);
   .........................
  ..........................

    if (atoi(lr_eval_string("{beijing}")) > 0)
        lr_error_message("发现北京!");

    if (atoi(lr_eval_string("{bei}")) > 0)
        lr_error_message("发现北!");
回复 支持 反对

使用道具 举报

该用户从未签到

6#
发表于 2007-4-20 16:13:02 | 只看该作者
刚才我在编辑中,还没编辑完,你就看到了?

哈哈。
回复 支持 反对

使用道具 举报

该用户从未签到

7#
 楼主| 发表于 2007-4-20 18:08:53 | 只看该作者
晕~   还是不行啊
回复 支持 反对

使用道具 举报

该用户从未签到

8#
发表于 2007-4-20 18:27:23 | 只看该作者
看我执行的:

脚本:

Action()
{
    int j;
        int i;
    int h;

        web_reg_find("Text=音乐MP3",
                "Search=body",
       "SaveCount=param1",
                LAST);
        web_reg_find("Text=百度搜索",
                "Search=body",
                 "SaveCount=param2_Count",
                LAST);
        web_reg_find("Text=中华英才网",
                "Search=body",
                 "SaveCount=param3_count",
                LAST);

        web_url("www.hao123.com",
                "URL=http://www.hao123.com/",
                "TargetFrame=",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t1.inf",
                "Mode=HTML",
                EXTRARES,
                "URL=/line.gif", ENDITEM,
                "URL=/images/dl.gif", ENDITEM,
                "URL=/images/dc.gif", ENDITEM,
                "URL=/images/dh.gif", ENDITEM,
                "URL=/images/df.gif", ENDITEM,
                "URL=/images/db.gif", ENDITEM,
                "URL=/images/guangg/ebay.gif", ENDITEM,
                LAST);



j=atoi(lr_eval_string("{param1_count}"));
lr_output_message("the j is %d",j);

i=atoi(lr_eval_string("{param2_Count}"));
lr_output_message("the i is %d",i);

h=atoi(lr_eval_string("{param3_count}"));
lr_output_message("the h is %d",h);

     if (atoi(lr_eval_string("{param1_count}")) > 0 )
      lr_output_message("音乐MP3");
       else
      lr_output_message("无音乐MP3");   

    if (atoi(lr_eval_string("{param2_Count}")) > 0)
      lr_output_message("百度搜索");
        else
       lr_output_message("无百度搜索");

    if (atoi(lr_eval_string("{param3_count}")) > 0)
      lr_output_message("中华英才网");
        else
    lr_output_message("无中华英才网");



        return 0;
}


结果:

Starting iteration 1.
Starting action Action.
Action.c(7): Registering web_reg_find was successful          [MsgId: MMSG-26390]
Action.c(11): Registering web_reg_find was successful          [MsgId: MMSG-26390]
Action.c(15): Registering web_reg_find was successful          [MsgId: MMSG-26390]
Action.c(20): Downloading resource "http://www.hao123.com/line.gif" (specified by argument number 10)          [MsgId: MMSG-26577]
Action.c(20): Downloading resource "http://www.hao123.com/images/dl.gif" (specified by argument number 12)          [MsgId: MMSG-26577]
Action.c(20): Downloading resource "http://www.hao123.com/images/dc.gif" (specified by argument number 14)          [MsgId: MMSG-26577]
Action.c(20): Downloading resource "http://www.hao123.com/images/dh.gif" (specified by argument number 16)          [MsgId: MMSG-26577]
Action.c(20): Downloading resource "http://www.hao123.com/images/df.gif" (specified by argument number 18)          [MsgId: MMSG-26577]
Action.c(20): Downloading resource "http://www.hao123.com/images/db.gif" (specified by argument number 20)          [MsgId: MMSG-26577]
Action.c(20): Downloading resource "http://www.hao123.com/images/guangg/ebay.gif" (specified by argument number 22)          [MsgId: MMSG-26577]
Action.c(20): Found resource "http://www.hao123.com/logo.gif" in HTML "http://www.hao123.com/"          [MsgId: MMSG-26659]
Action.c(20): Found resource "http://www.hao123.com/images/guangg/xiangmu2.gif" in HTML "http://www.hao123.com/"          [MsgId: MMSG-26659]
Action.c(20): Found resource "http://www.hao123.com/images/guangg/xiangmu.gif" in HTML "http://www.hao123.com/"          [MsgId: MMSG-26659]
Action.c(20): Found resource "http://www.hao123.com/logox2.gif" in HTML "http://www.hao123.com/"          [MsgId: MMSG-26659]
Action.c(20): Found resource "http://www.hao123.com/biaoshi.gif" in HTML "http://www.hao123.com/"          [MsgId: MMSG-26659]
Action.c(20): Found resource "http://www.hao123.com/js/sendmail.js" in HTML "http://www.hao123.com/"          [MsgId: MMSG-26659]
Action.c(20): Registered web_reg_find successful for "Text=音乐MP3" (count=1)          [MsgId: MMSG-26364]
Action.c(20): Registered web_reg_find successful for "Text=百度搜索" (count=1)          [MsgId: MMSG-26364]
Action.c(20): Registered web_reg_find successful for "Text=中华英才网" (count=2)          [MsgId: MMSG-26364]
Action.c(20): web_url("www.hao123.com") was successful, 35337 body bytes, 4745 header bytes          [MsgId: MMSG-26386]
Action.c(41): the j is 0
Action.c(44): the i is 1
Action.c(47): the h is 2
Action.c(52): 无音乐MP3
Action.c(55): 百度搜索
Action.c(60): 中华英才网
Ending action Action.
Ending iteration 1.
回复 支持 反对

使用道具 举报

该用户从未签到

9#
发表于 2007-4-20 21:51:53 | 只看该作者
error窗口不是每个都显示的吧。
回复 支持 反对

使用道具 举报

该用户从未签到

10#
 楼主| 发表于 2007-4-21 14:12:35 | 只看该作者
rickyzhu:error窗口不是每个都显示的吧

好像真是这样的,有什么解决办法么
用lr_output_message,写入日志是可以的,但是用 lr_error_message,写入日志是对的,但是error窗口只能显示一个。
回复 支持 反对

使用道具 举报

该用户从未签到

11#
发表于 2007-4-22 21:56:23 | 只看该作者
标注下 学习... 觉得应该可以用在页面文字检查
回复 支持 反对

使用道具 举报

该用户从未签到

12#
发表于 2007-4-23 09:44:23 | 只看该作者
晕,我一直在vugen理解楼主的问题。


如果是在controller的error里,如果错误代码是一样的,就显示为一条。但数量是对的。

如果错误代码不一样。就显示为多条。

即每个错误代码显示为一条。
回复 支持 反对

使用道具 举报

该用户从未签到

13#
发表于 2007-4-23 09:46:21 | 只看该作者
zee正解,:)

我描述不清楚,哈哈,不过理解对了。
回复 支持 反对

使用道具 举报

本版积分规则

关闭

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

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

GMT+8, 2024-9-24 23:23 , Processed in 0.089481 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

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