How to run mvn cucumber test using jar file?(如何使用 jar 文件运行 mvn 黄瓜测试?)
问题描述
我已经使用 maven 和 cucumber 创建了一个测试自动化框架.
I have created a test automation framework using maven and cucumber.
1) 我想创建一个包含所有内容(所有项目文件)的 jar 文件
1) I want to create a jar file which includes everything (all project files)
2) 然后我想使用上面创建的 jar 从命令行运行测试,就像使用命令一样
2) Then I want to run a test from the command line using above created jar like using the command
(mvn clean test -Dcucumber.options='--tags @all'
)
我不想使用 main 方法或任何东西.
I don't want to use the main method or anything.
推荐答案
java -Dcucumber.options="--tags @all" -jar your-test-jar.jar
试试这个.虽然我不确定你为什么不想使用 main 方法.如果不使用 main 方法,那就太复杂了.
Try this. Although I am not sure why you don't want to use the main method. If you don't use the main method it will just become too complicated.
更新:
编写一个 main 方法并从中运行 Cucumber main 方法.这些参数是您将作为 Cucumber 命令行参数传入的内容.
Write a main method and run Cucumber main method from it. The arguments are what you would pass in as your Cucumber command line arguments.
public static void main(String[] args) throws Throwable {
String[] arguments = {"a", "b"};
cucumber.api.cli.Main.main(arguments);
}
如果我清楚地理解了您的问题,这可能会完成您的工作.
If I have understood your question clearly, this might do your work.
这应该可以帮助您从可执行文件中运行 Cucumber.
This should help you run Cucumber from your executable.
这篇关于如何使用 jar 文件运行 mvn 黄瓜测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 jar 文件运行 mvn 黄瓜测试?


- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01
- 获取数字的最后一位 2022-01-01
- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
- 未找到/usr/local/lib 中的库 2022-01-01
- Eclipse 的最佳 XML 编辑器 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- 如何指定 CORS 的响应标头? 2022-01-01
- 转换 ldap 日期 2022-01-01
- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01