【问题标题】:GherkinScenarioFactory not execute any test caseGherkinScenarioFactory 不执行任何测试用例
【发布时间】:2021-12-28 09:29:20
【问题描述】:

我在我的项目中使用 cucumber testNG,并且已经添加了一些基于 Configuring BDD for executionQAF Cucumber 的配置,但是当我运行它时,GherkinScenarioFactory 没有运行任何测试。

[main] ERROR com.qmetry.qaf.automation.util.PropertyUtil - resources\application.properties (The system cannot find the path specified)
[main] INFO com.qmetry.qaf.automation.core.ConfigurationManager - ISFW build info: {qaf-Type=core, qaf-Revision=15, qaf-Version=2.1, qaf-Build-Time=20-N
ov-2019 22:28:06}
[main] ERROR com.qmetry.qaf.automation.core.ConfigurationManager - D:\Automation\resources not exist!
include groups []
 exclude groups: [] Scanarios location: resources/features
[main] INFO com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory - scenario.file.loc[Ljava.lang.String;@400cff1a
[main] INFO com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory - total test found: 0

我添加了依赖 qafqaf-cucumber 版本为 2.1.15。我还在步骤文件中添加了 @QAFTestStepProvider 注释。这是我的 testng.xml 文件:

<suite name="MyTest">
<test name="ComparationTest" >
    <parameter name="step.provider.pkg" value="com.example.steps" />
    <parameter name="scenario.file.loc" value="resources/features" />
    <classes>
        <class name="com.qmetry.qaf.automation.step.client.gherkin.GherkinScenarioFactory" />
    </classes>
</test>

在我添加的功能文件中:示例:{'datafile': 'resources/data/data.xls'} 最后在黄瓜跑步者中,我添加了插件“com.qmetry.qaf.automation.cucumber.QAFCucumberPlugin”

我还在学习,谁能告诉我我错过了什么?

【问题讨论】:

  • 请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: cucumber-jvm gherkin cucumber-java qaf


【解决方案1】:

您似乎指向了错误的资源和功能文件/目录位置。您需要为资源和场景目录提供项目根目录的相对路径。如果您观察日志还抱怨文件/文件夹不存在。

[main] ERROR com.qmetry.qaf.automation.util.PropertyUtil - resources\application.properties (The system cannot find the path specified)
[main] INFO com.qmetry.qaf.automation.core.ConfigurationManager - ISFW build info: {qaf-Type=core, qaf-Revision=15, qaf-Version=2.1, qaf-Build-Time=20-N
ov-2019 22:28:06}
[main] ERROR com.qmetry.qaf.automation.core.ConfigurationManager - D:\Automation\resources not exist!

确保项目根目录下有资源目录。

关于功能文件,根据您当前的配置 scenario.file.locresources/features。在这种情况下,请确保存在 &lt;project-root&gt;/resources/features。例如你的项目根是D:/Automation 然后resources/features 指向D:/Automation//resources/features 如果没有,则提供项目根目录的正确相对路径。

例如,resources/features 需要 &lt;project-root&gt;/resources/features,如果它不存在,则提供正确的位置。

同样适用于其他资源,包括属性文件和测试数据文件。

对于application.properties,它应该在&lt;project_root&gt;\resources\application.properties 下,如果它不存在,您可以使用系统属性application.properties=&lt;relateive_path_to_project&gt; 提供位置,或者放置在默认位置&lt;project_root&gt;\resources 下。

顺便说一句,

  • 而不是GherkinScenarioFactory推荐的是BDD2工厂com.qmetry.qaf.automation.step.client.text.BDDTestFactory2
  • 截至目前最新的 qaf 版本是 3.1.0-RC1 您使用的版本 2.1.15 相当旧。

【讨论】:

    猜你喜欢
    • 2022-01-06
    • 2018-12-07
    • 1970-01-01
    • 1970-01-01
    • 2018-10-08
    • 2015-06-15
    • 2017-02-13
    • 2020-01-16
    • 1970-01-01
    相关资源
    最近更新 更多