首页 > 解决方案 > 黄瓜场景和testng测试用例XML 1-1映射

问题描述

我需要你的帮助,我想设计与 testng 进行 1-1 映射的 Cucumber 场景。

例如,如果有两个功能文件,一个在 Cucumber 中有 10 个测试场景,另一个有 2 个测试场景,那么我应该能够在 testng XML 中编写 12 个测试用例名称并能够执行它们并能够报告它们。

通过在 pom.xml 中传递参数,上述方法将使我能够在每次运行时仅执行少数场景。

目前我在 testng xml 文件中编写了下面的内容,该文件进一步启动了 cucumber-testng-runner,然后进一步调用了可能有 10 个场景的 StepDefinition 和功能文件。

<test thread-count="5" name="TC001">
    <classes>
        <class name="testRunner.TestRunnernew" />
    </classes>
</test> <!-- TC001 -->

我不仅想在 testng xml 中编写 1 个测试用例,还想在我的 testng xml 中编写如上所示的 12 个测试用例,这样我就可以从 POM.xml 参数来仅执行少数场景

当我浏览互联网时,我发现有人已经为 Cucumber JVM 项目锁定了一个类似的问题

https://github.com/cucumber/cucumber-jvm/issues/1113

尽管问题现已关闭,但我无法找到问题的解决方案/实施。可能是因为我是 github 新手?

标签: automated-teststestngintegration-testingcucumber-jvm

解决方案


推荐阅读