博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
QTP10的Reporter对象
阅读量:4200 次
发布时间:2019-05-26

本文共 2492 字,大约阅读时间需要 8 分钟。

QTP10 中, Reporter 对象有了一些改进, ReportEvent 方法中增加了一个参数“ ImageFilePath ”。下面是函数原型描述:

Reporter.ReportEvent EventStatus , ReportStepName , Details [, ImageFilePath ]

Argument

Type

Description

EventStatus

Number or pre-defined constant

Status of the Test Results step:

0 or micPass: Causes the status of this step to be passed and sends the specified message to the Test Results window.

1 or micFail: Causes the status of this step to be failed and sends the specified message to the Test Results window. When this step runs, the test fails.

2 or micDone: Sends a message to the Test Results window without affecting the pass/fail status of the test.

3 or micWarning: Sends a warning message to the Test Results window, but does not cause the test to stop running, and does not affect the pass/fail status of the test.

ReportStepName

String

Name of the step displayed in the Test Results window.

Details

String

Description of the Test Results event. The string will be displayed in the step details frame in the Test Results window.

ImageFilePath

String

Optional . Path and filename of the image to be displayed in the Results Details tab of the Test Results window. Images in the following formats can be displayed: BMP, PNG, JPEG, and GIF.

Notes:

  • Images cannot be loaded from Quality   Center .
  • Including large images in the test results may impact performance.
  • If an image is specified as a relative path, QuickTest will first search the Results folder for the image and then the search paths specified in the Folders pane of the Options dialog box.

 

这样的话就可以在测试步骤的报告中添加截图信息,例如:

Browser("Browser").Page("WebPage").Image("MyLogo").CaptureBitmap("MyLogo.bmp")

Reporter.ReportEvent micDone, "Display Logo", "This is my logo", "MyLogo.bmp"

 

一般在碰到错误时,应该把当前屏幕截一下,以便后面查看测试日志时分析和定位出错的原因,例如下面的代码所示:

validation1 = Browser("Web Tours").Page("Web Tours").Frame("navbar").Image("Login").Exist(0)

If validation1 Then

    Reporter.ReportEvent micPass, "The Login object exists", "The Login object exists"

Else

       Desktop.CaptureBitmap "Fail.png",True

    Reporter.ReportEvent  micFail, "The Login object exists","The Login object doesn't exists","Fail.png"

End if

 

'...

 

validation2 = Browser("Web Tours").Page("Web Tours").Frame("navbar").Image("SignOff Button").Exist(0)

If validation2 Then

    Reporter.ReportEvent micPass, "The LogOut object exists", "The LogOut object exists"

Else

       Desktop.CaptureBitmap "Fail.png",True

    Reporter.ReportEvent  micFail, "The LogOut object exists","The LogOut object doesn't exists","Fail.png"

End if

 

 

 

 

转载地址:http://oejli.baihongyu.com/

你可能感兴趣的文章
10个出色的NoSQL数据库
查看>>
MySQL: InnoDB 还是 MyISAM?
查看>>
MySQL性能优化的最佳20+条经验
查看>>
SQL语言的组成部分 ddl dcl dml
查看>>
mysql数据库从库同步延迟的问题
查看>>
1.mysql数据库主从复制部署笔记
查看>>
mysql数据库主从同步的问题解决方法
查看>>
mysql 配置 - on xFanxcy.com
查看>>
MySQL数据库高并发优化配置
查看>>
mysql一: 索引优化
查看>>
测试人员,今天再不懂BDD就晚了!
查看>>
是QA还是AQ?
查看>>
害怕自动化(1)
查看>>
Script and Test Data
查看>>
在ITPub上发表文章《如何进行测试自动化的成本估算》
查看>>
深圳市软件质量提升工程系列活动——安全测试百人大课堂
查看>>
做培训讲师就像做一名导演
查看>>
深圳51testing笔架山一日游
查看>>
LoadRunner如何在脚本运行时修改log设置选项?
查看>>
QC数据库表结构
查看>>