2016-04-21 55 views
0

我跑黃瓜測試(使用Maven,在詹金斯)和輸出失敗場景的目標/ rerun.txt功能的文件夾,按照下列指示:https://github.com/cucumber/cucumber-jvm/issues/890Rerun.txt黃瓜是指classpath中,而不是

它創建rerun.txt並輸入失敗的場景,但將其輸入爲:features/name.feature:2。然後重新運行嘗試將它們作爲classpath/name.feature運行,但未能看到它們在src/test/resources/features中。

如果我將特徵文件放在類路徑中,我會得到不一致的過濾器錯誤(可能是因爲我在第一個調用中使用了標記而第二個調用中使用了文本)。

如何讓黃瓜輸出功能的正確路徑,或讓它找到基於rerun.txt的功能?

錯誤:

Running com.xxx.cucumber._RunCukesTest Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.002 sec <<< FAILURE!

initializationError(com.xxx.cucumber._RunCukesTest) Time elapsed: 0 sec <<< ERROR!

java.lang.IllegalArgumentException: Neither found on file system or on classpath: Not a file or directory: classpath\SubFolder\Test1.feature,

No resource found for: classpath:SubFolder/Test1.feature

附加信息: 來測試所有初始呼叫是通過標籤來完成。 所有功能位於classpath/src/test/resources/features中的子文件夾中 此測試必須每天自動運行在Jenkins中。

第一次運行時使用此:

@RunWith(Cucumber.class) 
@CucumberOptions(
    strict = false, 
    features={"src/test/resources/features/"}, 
    snippets=SnippetType.CAMELCASE, 
    plugin = { "pretty", "json:target/cucumber-reports/test-report.json", "html:target/cucumber-reports", 
      "rerun:target/rerun.txt"}) 
public class RunCukesTest { 
} 

失敗的情況下的第二次運行使用此:

@RunWith(Cucumber.class) 
@CucumberOptions(
    strict = false, 
    features={"@target/rerun.txt"}, 
    snippets=SnippetType.CAMELCASE, 
    plugin = {"pretty", "json:target/cucumber-reports/test-report.json", "html:target/cucumber-reports"}) 
public class _RunCukesTest { 
} 

回答

3

變化首先測試運行的特徵文件位置features = "." 這將使「重播.txt'將被更新爲特徵文件的正確路徑。