Coming Up for Air

Gradle Tip: Seeing Standard Streams During Tests

I’m not a real big fan of using standard out as a debugging strategy (I prefer an IDE and break points, for what it’s worth), but there are times when it’s either necessary or just convenient. The standard Gradle configuration, though, makes this a bit more difficult than it probably should be. Fortunately, Gradle also makes it easy to change:

build.gradle
1
2
3
test {
    testLogging.showStandardStreams = true
}

If you’d like to make this change globally, that’s also easy:

$HOME/.gradle/init.gradle
1
2
3
4
5
allprojects {
    tasks.withType(Test) {
        testLogging.showStandardStreams = true
    }
}
tags: Gradle

Quotes

Sample quote

Quote source