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 黄瓜测试?
基础教程推荐
- 如何在相机中应用自定义滤镜 [Surfaceview 预览]. 2022-01-01
- Maven:无效的目标版本:10 2022-01-01
- 在java中使用xpath和selenium解析HTML表格数据 2022-01-01
- 将 double 转换为 Int,向下舍入 2022-01-01
- 控制台应用程序中的 Java 键盘输入解析 2022-01-01
- doFilter()是在servlet的工作完成之前还是之后执行的? 2022-01-01
- JPA惰性列表上的流 2022-01-01
- Java ECDSAwithSHA256 签名长度不一致 2022-01-01
- 将 Windows 证书导入 Java 2022-01-01
- 在springboot中如何给mybatis加拦截器 2023-04-29
