【问题标题】:QAF | How to fail a custom step?质量保证 |如何使自定义步骤失败?
【发布时间】:2021-12-07 10:44:38
【问题描述】:

我创建了一个自定义步骤,我在其中进行了一些计算。我需要根据计算结果通过或失败该步骤。即使计算失败,目前步骤始终显示报告中的通过。另外,我想知道如何将失败注释传递给报告,因为我可以看到它是通过常见步骤实现的。

我使用的是 QAF 3.0.1 版

下面是一个示例:

@QAFTestStep(description = "I check quantity")
    public static void iCheckQuantity() {
         String product = getBundle().getString("prj.product");
         Int availableStock = getBundle().getString("prj.aStock");
         Int minStock = getBundle().getString("prj.minStock");

         if (availableStock < minStock) {
               // I want to fail the step here telling - minimum stock required to run the test for "product" is "minStock" but presenlty available is "availableStock"
          } 
    }

【问题讨论】:

  • 请提供示例代码,以便没有上下文的人可以理解
  • 分享代码/示例您正在尝试做的事情。

标签: selenium qaf


【解决方案1】:

我已经找到答案了。

import com.qmetry.qaf.automation.util.Validator.*;

assertFalse(true, "FAIL message here", "SUCCESS message here");

以下链接有助于了解有关验证的更多信息以及 QAF 中可用的不同类型的验证/断言。

参考: https://qmetry.github.io/qaf/latest/assertion_verification.html https://qmetry.github.io/qaf/latest/javadoc/com/qmetry/qaf/automation/util/Validator.html

【讨论】:

    猜你喜欢
    • 2017-06-23
    • 1970-01-01
    • 2020-05-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-28
    • 2022-06-28
    相关资源
    最近更新 更多