Geb — No reports dir has been configured

I’m a huge fan of Geb for UI web tests. Its a groovy library which emulates JQuery to drive the browser — it can be configured in different ways. You can set chromeDriver and fireFox configs, even PhantomJS.

I ran into this problem today running the tests via 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:884)
at geb.Browser.cleanReportGroupDir(Browser.groovy:917)
at geb.spock.GebSpec.methodMissing(GebSpec.groovy:56)
at geb.spock.GebReportingSpec.setupSpec(GebReportingSpec.groovy:33)

Obvious issue but took me a little time to figure out how to get around it in the IDE. Worked fine in gradle.

The trick was to set reportsDir in the GebConfig.groovy file.

reportsDir = new File("target/runtime_reports_dir")

This was first written on stuffivedeveloped.com I hope it might of come in handy.

BR,

John.