繁体   English   中英

使用命令行 --tags @my-tag 从 jar 运行 cucumber 测试执行

[英]Run cucumber test execute from jar with command line --tags @my-tag

I have built a cucumber test executable jar using the maven-assembly-plugin option and was successfully run the executable jar that run all the cucumber test within it.

但是,我喜欢尝试使用命令行上指定的可选标签运行可执行文件,但似乎无法这样做。 任何帮助和建议将不胜感激。

我的示例代码在 github 中:

https://github.com/txt8888/cucumber-executable

您可以io.cucumber.core.cli.Main main() Main

public class DreamCarMain {
    public static void main(String[] args) {

        Main.main(new String[] { "-g", "org.phan.kata.cucumber.integration.stepdefs", "-p", "pretty", "-t", args[0], "classpath:features" });
    }
}

不需要RunWithCucumberOptions注释。 将 TagExpression 替换为您想要执行的任何标签。 如果您想在调用后执行一些操作,请使用run()方法而不是main()

java -jar cucumber-integration-1.0.0-jar-with-dependencies.jar @TagExpression

暂无
暂无

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

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