如果网页上出现特定元素,有没有办法让 QTP 测试失败
我正在尝试使用 QTP 测试基于 JSP 的 Web 应用程序。在某些页面上,JSP 被编码为向浏览器返回特定的 div 元素,该元素将具有 ID 属性,只有底层模型设置了特定的布尔标志。我希望能够开发一个 QTP 测试,如果 div 出现在返回的网页中,该测试就会失败。然而,QTP 文档似乎没有任何关于如何执行此操作的详细信息。
I am trying to test a JSP based web application with QTP. On some of the pages the JSP is coded to return a particular div element, which will have an ID attribute, to the browser, only of the underlying model has a certain boolean flag set. I'd like to be able to develop a QTP test that fails if the div is present in the returned web page. However, the QTP documentation doesn't seem to have any details on how to do this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
重点是检测条件是否适用,然后显式地使测试失败。
The point is to detect if the condition applies and then explicitly fail the test.
QTP 的默认行为是在检查点失败时写入“报告”。即如果在页面上找不到某个元素,QTP 将自动写入日志报告中。为了禁用该功能,并根据您的测试场景自定义您的报告,您可以从
仅在发现异常行为时才开始写。
报告者.Filter = rfDisableAll
'检查点验证
报告者.Filter = rfEnableAll
The default behavior for QTP is to write in 'Report' when a check point fails. i.e. if an element is not found on the page , automatically the QTP will write in the log report. In order to disable that , and to customize your report depending on your test scenarios, you can disable the report logging from the
beginning and write only in case you found an abnormal behavior.
Reporter.Filter = rfDisableAll
'check point validations
Reporter.Filter = rfEnableAll