查看完整版本: 请问QTP中如何使用描述性编程来写checkpoint的验证

lqin1982121 2008-6-17 09:29

请问QTP中如何使用描述性编程来写checkpoint的验证

如题,比如验证一个link是否存在。请教各位达人,最好能有代码参考,谢谢了!!

zte_boy 2008-6-17 12:55

if link.exist then
  Reporter.ReportEvent micpass,"link exist"
else
  Reporter.ReportEvent micfail,"link not exist"
end if

lqin1982121 2008-6-17 16:28

试验过了,成功了,谢谢谢谢!!是不是其他的网页元素就可以类推了?

qicyt1812 2008-6-20 15:52

奇怪了,我在9.0中测试,怎么说link对象的该属性不存在啊?link好像没有exist属性哦
if link.exist then
  Reporter.ReportEvent micpass,"link exist"
else
  Reporter.ReportEvent micfail,"link not exist"
end if

qicyt1812 2008-6-20 15:52

是不是前面还要加上父对象啊?

cs998998 2008-6-27 00:10

是的,需要有父类的。

If Browser(":=").Page(":=").Link(“name:=TOP").Exist(0) Then
  Reporter.ReportEvent micpass,"link exist"
Else
  Reporter.ReportEvent micfail,"link not exist"
End if

xiaoyaoke 2008-6-27 09:38

[quote]原帖由 [i]zte_boy[/i] 于 2008-6-17 12:55 发表 [url=http://bbs.51testing.com/redirect.php?goto=findpost&pid=995500&ptid=117670][img]http://bbs.51testing.com/images/common/back.gif[/img][/url]
if link.exist then
  Reporter.ReportEvent micpass,"link exist"
else
  Reporter.ReportEvent micfail,"link not exist"
end if [/quote]

这个叫描述性编程?呵呵
页: [1]
查看完整版本: 请问QTP中如何使用描述性编程来写checkpoint的验证