Run cucumber test execute from jar with command line --tags @my-tag(使用命令行从 jar 运行黄瓜测试执行 --tags @my-tag)
问题描述
我使用 maven-assembly-plugin 选项构建了一个黄瓜测试可执行 jar,并成功运行了在其中运行所有黄瓜测试的可执行 jar.
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.
但是,我喜欢尝试使用在命令行上指定的可选标签来运行可执行文件,但似乎无法这样做.任何帮助和建议将不胜感激.
However, I like to try to run the executable with optional tags specified on the command line but could not seem to do so. Any help and suggestion would be greatly appreciate.
我的示例代码在github:
My sample code is in github:
https://github.com/txt8888/cucumber-executable
推荐答案
您可以使用 io 中
包.Main
类的 main()
方法.cucumber.core.cli.Main
You could use the main()
method of the Main
class from the io.cucumber.core.cli.Main
package.
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" });
}
}
不需要 RunWith
和 CucumberOptions
注释.将 TagExpression 替换为您想要执行的任何标签.如果您想在调用后执行一些操作,请使用 run()
方法而不是 main()
.
There is no need for the RunWith
and CucumberOptions
annotation. Replace the TagExpression with whatever tags u want to execute. If you want to do some action after the call then use the run()
method instead of the main()
.
java -jar cucumber-integration-1.0.0-jar-with-dependencies.jar @TagExpression
这篇关于使用命令行从 jar 运行黄瓜测试执行 --tags @my-tag的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用命令行从 jar 运行黄瓜测试执行 --tags @my-tag
基础教程推荐
- 如何使用 Eclipse 检查调试符号状态? 2022-01-01
- 由于对所需库 rt.jar 的限制,对类的访问限制? 2022-01-01
- 如何强制对超级方法进行多态调用? 2022-01-01
- 在螺旋中写一个字符串 2022-01-01
- Spring Boot Freemarker从2.2.0升级失败 2022-01-01
- 如何对 HashSet 进行排序? 2022-01-01
- Java 中保存最后 N 个元素的大小受限队列 2022-01-01
- 如何在不安装整个 WTP 包的情况下将 Tomcat 8 添加到 Eclipse Kepler 2022-01-01
- 如何使用 Stream 在集合中拆分奇数和偶数以及两者的总和 2022-01-01
- 首次使用 Hadoop,MapReduce Job 不运行 Reduce Phase 2022-01-01