2016-11-19 42 views
1

我無法從IntelliJ IDE運行我的功能測試。當我運行的功能測試,我得到了以下錯誤消息:Geb/Spock錯誤 - 沒有報告dir已配置,您需要在配置文件中或通過構建適配器設置

java.lang.IllegalStateException: No reports dir has been configured, you need to set in the config file or via the build adapter. 

    at geb.Browser.getReportGroupDir(Browser.groovy:899) 
    at geb.Browser.cleanReportGroupDir(Browser.groovy:932) 
    at geb.spock.GebSpec.methodMissing(GebSpec.groovy:56) 
    at geb.spock.GebReportingSpec.setupSpec(GebReportingSpec.groovy:37) 

根據我的研究,我需要做的是在GebConfig.groovy添加以下代碼: reportsDir = new File("target/runtime_reports_dir")

我加到GebConfig.groovy的行並重建項目,但仍遇到同樣的問題。有沒有其他解決這個錯誤?

+2

您的GebConfig.groovy文件位於何處?你在IntelliJ以外如何構建項目? – erdi

回答

1

爲你的GebConfig添加reportsDir ='target/geb-reports'應該如何解決這個問題,你能告訴我你的GebConfig文件嗎?

還有另一個修復方法,你的測試類擴展了GebReportingSpec,你可以把它轉換爲GebSpec,它也應該可以工作。

+0

@ user5167041這能解決你的問題嗎? – mackowski

0

我有同樣的問題,同時具有reportsDir在GebConfig

添加資源文件夾(在我的GebConfig所在地)爲「測試源根」配置正確的伎倆,我

要標記文件夾「測試源根」:

  • 右鍵單擊該文件夾中
  • 馬克目錄爲
  • 測試小號根源

快樂測試!