簡體   English   中英

使用命令行 --tags @my-tag 從 jar 運行 cucumber 測試執行

[英]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 中:

https://github.com/txt8888/cucumber-executable

您可以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" });
    }
}

不需要RunWithCucumberOptions注釋。 將 TagExpression 替換為您想要執行的任何標簽。 如果您想在調用后執行一些操作,請使用run()方法而不是main()

java -jar cucumber-integration-1.0.0-jar-with-dependencies.jar @TagExpression

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM