我需要獲取功能場景,而不用通過cmd運行maven測試。黃瓜有'dryRun'選項。但是不知道如何將此選項添加到pom.xml。我嘗試了很多變體,但沒有幫助。Cucumber/Maven:如何在pom.xml中爲變量使用Cucumber選項?
鍵入CMD:
mvn verify -Dfeature=Forum.feature -DdryRun=false
但我得到的錯誤。 -DryRun選項不起作用。
我需要獲取功能場景,而不用通過cmd運行maven測試。黃瓜有'dryRun'選項。但是不知道如何將此選項添加到pom.xml。我嘗試了很多變體,但沒有幫助。Cucumber/Maven:如何在pom.xml中爲變量使用Cucumber選項?
鍵入CMD:
mvn verify -Dfeature=Forum.feature -DdryRun=false
但我得到的錯誤。 -DryRun選項不起作用。
根據你的截圖中,你有以下配置:
<systemPropertyVariables>
<cucumber.options>
<![CDATA[--tags ${tags} ${dryRun} [${cucumber.features.dir}/${feature}]]>
</cucumber.options>
</systemPropertyVariables>
這將插入true
或false
到環境變量,它是不是一個有效的選擇,而不是被解釋爲特徵文件的路徑。
黃瓜代替--dry-run
或--no-dry-run
(https://github.com/cucumber/cucumber-jvm/blob/v1.2.0/core/src/main/java/cucumber/runtime/RuntimeOptions.java#L116)。該解決方案是這樣定義你的財產:
<properties>
<dryRun>--dry-run</dryRun>
</properties>
無關的是,該功能路徑之前左括號也會引起黃瓜未找到該功能。
這很有幫助。 – user2837153 2014-12-22 16:59:48
@ user2837153謝謝,如果這個答案解決了您的問題,您可以將其標記爲已接受。投票箭頭左側應該有一些複選標記。 – 2014-12-22 17:45:53
請在您的文章中嵌入pom.xml的相關部分,因爲這樣可以更容易地引用和指出問題 – 2014-12-20 15:47:12