51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 2160|回复: 8
打印 上一主题 下一主题

[原创] 能不能更改QTP的测试结果

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2006-6-30 10:17:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我想增加一个非法的记录到IE页面中,如果添加成功,则测试失败,否则则PASS。我在脚本中对非法记录是否存在增加了一个检查点,现在的问题是检查点成功,QTP返回的结果也是Pass,
可是这个测试实际结果为Fail,这种情况怎么处理呀?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

  • TA的每日心情
    开心
    2015-5-4 14:23
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    2#
    发表于 2006-6-30 10:37:07 | 只看该作者
    你的意思要在测试结果中表现出:如果添加非法记录,则测试结果显示测试失败??

    [ 本帖最后由 xueboy118 于 2006-6-30 10:42 编辑 ]
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    3#
     楼主| 发表于 2006-6-30 10:40:28 | 只看该作者
    原帖由 xueboy118 于 2006-6-30 10:37 发表
    你可以试一下把你要添加的记录的信息参数化,让脚本在运行时从data table中取值


    根本没明白我的意思。。。
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2015-5-4 14:23
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    4#
    发表于 2006-6-30 10:51:21 | 只看该作者
    如果你是想让QTP的测试结果把你的的测试反映出来,即添加非法记录测试失败,你可以在脚本中,就你添加检查点的脚本的后面,在添加如下 脚本:
    Reporter.ReportEvent 1, "测试失败 ", "测试失败!!!.“
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    5#
     楼主| 发表于 2006-6-30 10:56:52 | 只看该作者
    原帖由 xueboy118 于 2006-6-30 10:51 发表
    如果你是想让QTP的测试结果把你的的测试反映出来,即添加非法记录测试失败,你可以在脚本中,就你添加检查点的脚本的后面,在添加如下 脚本:
    Reporter.ReportEvent 1, "测试失败 ", "测试失败! ...



    可是QTP最终的结果还是Fail,不是吗? 我想让QTP最后的结果就是失败。。。
    我想让QTP的结果和检查点的结果正好相反。
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    开心
    2015-5-4 14:23
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    6#
    发表于 2006-6-30 11:08:26 | 只看该作者
    添加脚本   Reporter.ReportEvent 1, "测试失败 ", "测试失败!!!.“
    QTP可以正常的把脚本执行下去,包括你的检查点,只不过会在测试结果中,增加一个失败的标识
    如图

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

    x
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    7#
    发表于 2006-6-30 12:13:14 | 只看该作者
    其实我们不需要总去依靠QTP的结果文件的,我们可以在脚本中添加相应的代码,把测试结果信息输出到我们的指定文件
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    8#
    发表于 2006-6-30 17:01:37 | 只看该作者
    原帖由 xiaonan 于 2006-6-30 12:13 发表
    其实我们不需要总去依靠QTP的结果文件的,我们可以在脚本中添加相应的代码,把测试结果信息输出到我们的指定文件



    怎么样输出到指定文件呢?是在每一个检查点后面都要写么?
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    9#
    发表于 2006-6-30 17:33:50 | 只看该作者
    Reporter.ReportEvent EventStatus, ReportStepName, Details [, in]
    Argument
    Type
    Description

    EventStatus  Number or pre-defined constant  Status of the report step:
    0 or micPass: Causes the status of this step to be passed and sends the specified message to the report.
    1 or micFail: Causes the status of this step to be failed and sends the specified message to the report. When this step runs, the test or component fails.
    2 or micDone: Sends a message to the report without affecting the pass/fail status of the test or component.
    3 or micWarning: Sends a warning message to the report, but does not cause the test or component to stop running, and does not affect the pass/fail status of the test or component.  
    ReportStepName  String  Name of the intended step in the report (object name).  
    Details  String  Description of the report event. The string will be displayed in the step details frame in the report.  
    in  N/A  Not in use.  


    Example
    The following examples use the ReportEvent method to report a failed step.

    Reporter.ReportEvent 1, "Custom Step", "The user-defined step failed."
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

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

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

    GMT+8, 2024-5-5 05:00 , Processed in 0.078554 second(s), 28 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

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