51Testing软件测试论坛
标题:
报告优化
[打印本页]
作者:
dqf
时间:
2012-3-13 16:30
标题:
报告优化
'检查点
Browser("百度一下,你就知道").Page("百度一下,你就知道").WebEdit("wd").Check CheckPoint("wd")
Browser("百度一下,你就知道").Page("百度一下,你就知道").WebButton("百度一下").Check CheckPoint("百度一下")
'手工代码
Dim wd_value,wd_name,wd_type,wd_visible
Dim bt_name,bt_type,bt_visible
wd_value=Browser("百度一下,你就知道").Page("百度一下,你就知道").WebEdit("wd").GetROProperty("value")
wd_name=Browser("百度一下,你就知道").Page("百度一下,你就知道").WebEdit("wd").GetROProperty("name")
wd_type=Browser("百度一下,你就知道").Page("百度一下,你就知道").WebEdit("wd").GetROProperty("type")
wd_visible=Browser("百度一下,你就知道").Page("百度一下,你就知道").WebEdit("wd").GetROProperty("visible")
If wd_value="" Then
Reporter.ReportEvent micPass,"默认值","期望为空,实际为:" & wd_value
else
Reporter.ReportEvent micFail,"默认值","期望为空,实际为:" & wd_value
End If
If wd_name="wd"Then
Reporter.ReportEvent micPass,"名称","期望为wd,实际为:" & wd_name
else
Reporter.ReportEvent micFail,"名称","期望为wd,实际为:" & wd_name
End If
If wd_type="text" Then
Reporter.ReportEvent micPass,"类型","期望为text,实际为:" & wd_type
else
Reporter.ReportEvent micFail,"类型","期望为text,实际为:" & wd_type
End If
If wd_visible=true Then
Reporter.ReportEvent micPass,"状态","期望为可用,实际为:" & wd_visible
else
Reporter.ReportEvent micFail,"状态","期望为可用,实际为:" & wd_visible
End If
bt_name=Browser("百度一下,你就知道").Page("百度一下,你就知道").WebButton("百度一下").GetROProperty("name")
bt_type=Browser("百度一下,你就知道").Page("百度一下,你就知道").WebButton("百度一下").GetROProperty("type")
bt_visible=Browser("百度一下,你就知道").Page("百度一下,你就知道").WebButton("百度一下").GetROProperty("visible")
If bt_name="百度一下" Then
Reporter.ReportEvent micPass,"名称","期望为百度一下,实际为:" & bt_name
else
Reporter.ReportEvent micFail,"名称","期望为百度一下,实际为:" & bt_name
End If
If bt_type="submit" Then
Reporter.ReportEvent micPass,"类型","期望为submit,实际为:" & bt_type
else
Reporter.ReportEvent micFail,"类型","期望为submit,实际为:" & bt_type
End If
If bt_visible=true Then
Reporter.ReportEvent micPass,"状态","期望为可用,实际为:" & bt_visible
else
Reporter.ReportEvent micFail,"状态","期望为可用,实际为:" & bt_visible
End If
复制代码
前面2句是用QTP的标准检查点来做的,后面是自己写的代码,问题:
1.在QTP的标准检查点中是否可以自行配置各检查项呢?例如它是没有visible这项检查项,是否在哪能将此添加进行?
2.报告显示问题:
能否在自己写的代码生成的报告中也能象检查点生成的报告那样,以不同的图标来显示不同类型的对象;
树状结构,自己写的代码生成的报告中能否像“wd“的检查点生成的报告一样将4项做为一个结果来显示;另外在显示的层次结构上是否也可向检查生成的报告那样呢?
请大家帮忙看一下,如果可能的话请大家指教一下如何改。谢谢!
作者:
dqf
时间:
2012-3-13 16:32
本帖最后由 dqf 于 2012-3-13 16:33 编辑
图片怎么没上来呀 放附件中吧
作者:
snakeshiy
时间:
2012-3-13 16:48
1. 应该是不能自行配置的(不是很确定),使用自定义验证的方式会更加灵活
2. 使用Reporter对象的隐藏方法LogEvent,SetContext,UnSetContext,GetContext等方法可以达到你需要的效果,具体参考
http://www.ltesting.net/ceshi/ce ... 11/1215/203769.html
作者:
dqf
时间:
2012-3-14 15:30
非常感谢 层次感出来了,但那个图标好象还是不行呀(无论我写210还是310、510的显示都是同一个);另外将此函数注册进去,像内置函数使用方便还是去了解一下
作者:
snakeshiy
时间:
2012-3-14 16:32
回复
4#
dqf
图标我有试过从200~210之间的会有不一样的图标,其他的就不知道了。。。
作者:
pl80601983
时间:
2012-3-14 17:07
同意3楼
作者:
dqf
时间:
2012-3-15 16:18
如何将自定义函数注册成像内置函数一样使用方便呀。
http://www.51testing.com/html/95/n-96995.html
;
http://www.51testing.com/html/89/n-96989.html
;这两个已经参见过了,但在运行时报错,提示:需要对象
作者:
dqf
时间:
2012-3-21 08:45
等人解决
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2