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 黄瓜测试?
基础教程推荐
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
