qtp:checkpoint、自定义检查点

本文介绍QTP中的两种检查点方法:checkpropertyobject.checkproperty用于验证对象属性是否符合预期,以及reportevent用于自定义测试结果的报告。通过实例展示了如何使用这两种方法,并解释了它们之间的区别。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、检查点、验证点方法——checkproperty
object.checkproperty(property name,property value,【timeout】) object:对象的意思
property name:要检查的属性名
property value:预期的结果值(如果最后检查完毕后,发现不符合预期值,则会返回false,并引入qtp测试报告,反之则反回true,并在测试报告中以passed显示)
time out:等待时间,单位:毫秒
例子:browser(“百度”).page(“百度”).webedit(“wd”).set “haha”
browser(“百度”).page(“百度”).webedit(“wd”).checkproperty“value”,“haha”

2、自定义检查点——reportevent
reporter.reportevent eventstatus,reportstepname,details【,imagefilepath】
eventstatus。测试结果的状态,有四种状态
(1)micpass:对应数字0
(2)micfail:对应数字1
(3)micdone:对应数字2
(4)micwarning:对应数字3
reportstepname,在测试结果中显示的测试名字
details,在测试结果中显示的测试描述
imagefilepath,不是必填项,将截图插入到报告中

例子:for i=1 to 4
if i=1 then
reporter.reportevent micpass,“step 1”,“micpass =0 ”
else if i=2 then
reporter.reportevent micfail,“step 2”,“micfail=1”
else if i=3 then
reporter.reportevent micdone,“step 3”,“micdone=2”
else if i=4 then
reporter.reportevent 3,"step 4","3=micwarinig"
else
end if
next

3、自定义检查点和checkproperty区别
(1)在一个测试中,只要有一个fail,整个测试的结果就是“fail”
(2)如果没有fail,只要有一个 warning,这个测试的结果就是 warning
(3)全部都是 pass,整个测试结果才是 pass
(4)done 不影响这个测试的结果







评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值