ReportEvent的用法

一直在坚持看买的这本QTP书,看了一半了,嘿嘿,不错,夸夸自己。。。好了,进入正题。。。

今天看到“报告实例”了,里面有一个函数ReportEvent是运行脚本过程中添加一个事件到test results,具体用法在QTP中按F1搜索ReportEvent这个函数就行,写的很清楚,不过是不是有的人一看就晕,不想看呢,因为全是英文。。。呵呵

 

格式:Reporter.ReportEvent EventStatus, ReportStepName, Details [, in]
'EventStatus
状态:pass0,失败:1done:2,警告:3
状态:0 or micPass1 or micFail2 or micDone3 or micWarning:
ReportStepName
Name of the intended step in the report (object name)
Details:Description of the report event. The string will be displayed in the step details frame in the report.

 

可以用QTP自带的flight订票系统来试验一下:

Window("Flight Reservation").Activate'激活订票系统窗口
Window("Flight Reservation").WinMenu("Menu").Select "Analysis;Reports..."'选择菜单栏中的analysis——>reports

window("记事本").Close'关闭报告'

 

然后再给脚本添加个条件判断语句:

Window("Flight Reservation").Activate
Window("Flight Reservation").WinMenu("Menu").Select "Analysis;Reports..."
If window("记事本").Exist Then
 reporter.ReportEvent micPass,"报告","报告生成并被打开"
 window("记事本").Close'关闭报告'
else
reporter.ReportEvent 3,"报告","报告未被打开"
End If

 

回放一下看看效果

再看看,在results里面是不是添加了一个事件

看到了吗?左边第一个画圈的是

---

Reporter.ReportEvent EventStatus, ReportStepName, Details [, in]
reporter.ReportEvent micPass,"报告","报告生成并被打开"

--
中的ReportStepName,最右边那个Details

这下明白了吗?

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值