Search code examples
groovyselenium-webdrivercucumbergeb

How to add logging in Geb


I am using Geb with Gradle/Groovy/Selenium Cucumber.

How can I do logging to the console while run via terminal. Further even though I can use println statement in groovy code those not get printed in the console.

Thanks


Solution

  • If you want to see standard streams (i.e. standard out to which println() writes) printed to the console when running tests via gradle build then you need to enable it for your test task:

    test {
        testLogging.showStandardStreams = true
    }
    

    You can also see standard out in one of the tabs in test reports even if you don't enable the above option.