Reporter.ReportEvent 在 UFT/QTP 中的应用示例

QTP 中的 Reporter.ReportEvent

Reporter.ReportEvent 是 QTP 提供的一种标准方法,用于向测试结果窗口发送自定义消息。

HP QTP 教程演示了函数 Reporter.ReportEvent结果格式化 的使用。

本教程将要求您开发一个脚本。

为了最大限度地提高您的学习效果,请务必完成脚本练习

如果视频无法访问,请点击此处

您可以使用 Reporter.ReportEvent 在 Micro Focus UFT 的测试结果树中报告自定义测试步骤。

语法

Reporter.ReportEvent EventStatus, ReportStepName, Details [, ImageFilePath]
  • 事件状态可以有以下值:
    • 0 或 micPass 会向测试结果窗口发送通过状态
    • 1 或 micFail 会向测试结果窗口发送失败状态
    • 2 或 micDone 会向测试结果窗口发送消息,但不会影响通过/失败状态
    • 3 或 micWarning 会向结果窗口发送警告消息
  • 当使用自动化工具执行测试用例时,某些用户可能难以理解测试结果。您可以使用 results.xml 来创建 XSL,它将根据您的偏好呈现测试结果
  • 您可以使用 VBScript 库函数来将结果存储在 xls 或文本文件中。