【问题标题】:Using But keyword in BDD throws Step not implemented exception while running scenario in Quantum framework在 BDD 中使用 But 关键字在 Quantum 框架中运行场景时抛出 Step not implemented 异常
【发布时间】:2019-08-28 08:00:20
【问题描述】:

我正在尝试在 Quantum 框架中运行 BDD 场景。执行时,使用 But 关键字的步骤失败并出现错误“步骤尚未实现”。

Auto-generated code snippet by QMetry Automation Framework.
TODO: remove NotYetImplementedException and call test steps
    throw new NotYetImplementedException();

我没有看到任何其他 BDD 关键字的问题。只有以“But”关键字开头的步骤会失败,但出现上述异常。我有什么遗漏的吗?

请找出我们正在使用的场景

Scenario: Validate help me log in link
Given user have the "XXX" app in mobile
But user open the app by the name "XXX"

步骤实现:

import cucumber.api.java.en.But;
...
    @But("^user open the app by the name \"([^\"]*)\"$")
    public void user_open_the_app_by_the_name(String arg1) throws Throwable {
        try {
            AppiumUtils.stopApp(arg1);
        } catch (Exception e) {
        } 
    }

【问题讨论】:

  • 它是否使用And 而不是But?你能提供你的床步调用、步骤定义和自动生成的代码片段吗?
  • 已经更新了场景和代码供大家参考。

标签: selenium cucumber bdd qaf perfecto


【解决方案1】:

QAF 使用以下 BDD 关键字:

  • 给定
  • 什么时候
  • 那么
  • 使用

由于But 不是内置关键字,它可能会给您带来错误。这并不意味着您不能使用But 作为关键字!通过定义synonyms,可以支持任何自定义关键字。

您可以尝试在application.properties 文件中添加以下属性:

And=But;And

这将允许您使用 But 作为关键字,应该可以解决您的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多