Intellij idea Geb/Spock错误-没有配置报告目录,您需要在配置文件中或通过构建适配器进行设置

Intellij idea Geb/Spock错误-没有配置报告目录,您需要在配置文件中或通过构建适配器进行设置,intellij-idea,gradle,groovy,functional-testing,geb,Intellij Idea,Gradle,Groovy,Functional Testing,Geb,我无法从IntelliJ IDE运行功能测试。运行功能测试时,我收到以下错误消息: 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.c

我无法从IntelliJ IDE运行功能测试。运行功能测试时,我收到以下错误消息:

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=新文件(“目标/运行时报告\u目录”)


我将该行添加到GebConfig.groovy并重建了项目,但仍然遇到相同的问题。是否有其他修复此错误的方法?

将reportsDir='target/geb reports'添加到您的GebConfig应该修复此错误,您可以向我显示您的GebConfig文件吗


还有另一个修复程序,您的测试类扩展了GebReportingSpec,您可以将它更改为GebSpec,它也应该可以工作。

我也遇到了同样的问题,同时在GebConfig中正确配置了reportsDir

添加resources文件夹(我的GebConfig所在的地方)作为“testsources Root”对我来说是个好办法

要将文件夹标记为“测试源根目录”:

  • 在文件夹中单击鼠标右键
  • 将目录标记为
  • 测试源根

快乐测试

GebConfig.groovy文件位于哪里?在IntelliJ之外,您使用什么来构建项目?