google搜索 站内搜索                 软件测试门户 | 软件测试培训 | 文章资料精选 | 软件测试论坛 | 测试解决方案 | 软件测试博客 | 测试招聘求职 
打印

[求助] 能不能更改QTP的测试结果

能不能更改QTP的测试结果


我想增加一个非法的记录到IE页面中,如果添加成功,则测试失败,否则则PASS。我在脚本中对非法记录是否存在增加了一个检查点,现在的问题是检查点成功,QTP返回的结果也是Pass,
可是这个测试实际结果为Fail,这种情况怎么处理呀?

TOP

你的意思要在测试结果中表现出:如果添加非法记录,则测试结果显示测试失败??

[ 本帖最后由 xueboy118 于 2006-6-30 10:42 编辑 ]

TOP

引用:
原帖由 xueboy118 于 2006-6-30 10:37 发表
你可以试一下把你要添加的记录的信息参数化,让脚本在运行时从data table中取值
根本没明白我的意思。。。

TOP

如果你是想让QTP的测试结果把你的的测试反映出来,即添加非法记录测试失败,你可以在脚本中,就你添加检查点的脚本的后面,在添加如下 脚本:
Reporter.ReportEvent 1, "测试失败 ", "测试失败!!!.“

TOP

引用:
原帖由 xueboy118 于 2006-6-30 10:51 发表
如果你是想让QTP的测试结果把你的的测试反映出来,即添加非法记录测试失败,你可以在脚本中,就你添加检查点的脚本的后面,在添加如下 脚本:
Reporter.ReportEvent 1, "测试失败 ", "测试失败! ...
可是QTP最终的结果还是Fail,不是吗? 我想让QTP最后的结果就是失败。。。
我想让QTP的结果和检查点的结果正好相反。

TOP

添加脚本   Reporter.ReportEvent 1, "测试失败 ", "测试失败!!!.“
QTP可以正常的把脚本执行下去,包括你的检查点,只不过会在测试结果中,增加一个失败的标识
如图
附件: 您所在的用户组无法下载或查看附件

TOP

其实我们不需要总去依靠QTP的结果文件的,我们可以在脚本中添加相应的代码,把测试结果信息输出到我们的指定文件

TOP

引用:
原帖由 xiaonan 于 2006-6-30 12:13 发表
其实我们不需要总去依靠QTP的结果文件的,我们可以在脚本中添加相应的代码,把测试结果信息输出到我们的指定文件
怎么样输出到指定文件呢?是在每一个检查点后面都要写么?

TOP

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."
MSN: keanqian@hotmail.com
软件测试工具及服务提供商

TOP

 
当前时区 GMT+8, 现在时间是 2008-12-5 00:49Copyright(C)上海博为峰软件技术有限公司 2001-2007 电话:021-64471599-8017
当您在访问网站、论坛及博客过程中遇到问题时可发送email:webmaster@51testing.com或发送论坛短信至管理员风在吹