[英]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 中:
您可以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" });
}
}
不需要RunWith
和CucumberOptions
注釋。 將 TagExpression 替換為您想要執行的任何標簽。 如果您想在調用后執行一些操作,請使用run()
方法而不是main()
。
java -jar cucumber-integration-1.0.0-jar-with-dependencies.jar @TagExpression
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.