繁体   English   中英

如何在Eclipse调试配置中将黄瓜标签指定为调用参数?

[英]how to specify cucumber tags as invocation param in eclipse debug configuration?

我有一个Spring Boot项目。 在其中,我有一个Java类BookTests,其中包含:

@RunWith(Cucumber.class)
@CucumberOptions(
        plugin = {
                "pretty",
                "html:target/acceptance-test-report",
                "json:target/cucumber/cucumber.json"
        },
        glue = {
                "com.my.sdk.test",
                "com.my.book.test"
        }
        ,tags = {"@findConsideringGrants"}
        )
public class BookTests {
    // No implementation required.  The Cucumber annotations drive the test execution.

}

我正在使用Junit4。当我“调试为JUnit测试”此类时,它仅运行以“ @findConsideringGrants注释”的功能文件(应如此)

有没有一种方法我不必在Java类中对此标签注释进行硬编码,而是将标签指定为Program argumnents或VM参数?

我尝试使用Program argnnents配置它,但是经过以下所有尝试,它忽略了该参数,并在我所有的功能/标签上运行了测试:

--tags findConsideringGrants 
-tags findConsideringGrants
--tags @findConsideringGrants 
-tags @findConsideringGrants

所以要总结一下,我正在寻找一种方法
1)在Eclipse中调试某些功能
2)无需将功能名称硬编码到Java源代码中。 通过某种方式仅配置调试配置。

这有可能吗?

如果使用的是maven,则可以使用mvn test -Dcucumber.options="--tags @findConsideringGrants"

或者,您可以使用Main.main(new String[]{"-g", "classpath to step definition file","-t", "tags to use", "-p", "plugins to use", "Full path to feature file"}) cli命令运行Main.main(new String[]{"-g", "classpath to step definition file","-t", "tags to use", "-p", "plugins to use", "Full path to feature file"}) 功能文件路径必须是最后一个选项。

从eclipse运行-转到“调试配置”或“运行配置”窗口的“环境”选项卡。 点击“新建”按钮。 对于“名称”,添加“ cucumber.options ”,“值”,添加“ --tags @findConsideringGrants ”。 应用并运行。 如果要添加特定的功能文件路径,请仅添加该路径末尾的路径。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM