How do I get Gradle to shut up about TestNG tests?

(Todd Bradley) #1

I’m using Gradle to build and run tests that use TestNG. When I run the tests, Gradle was presenting the log output from the tests in two ways I don’t like.

First, it printed out every time it starts a new test, like this:

Gradle suite > Gradle test > STARTED

I didn’t want that, so I did this:


(instead of events “started”, “passed”, “skipped”, “failed”, “standardOut”, “standardError”)

So now Gradle only echoes my stderr, but it also announces what it’s going, with a line like this:

Gradle suite > Gradle test STANDARD_ERROR

Can I get it to just pass the output through to the console without telling me that it’s doing so?

Also, either Gradle or TestNG is printing out lines like this:

Running test: test method […blah blah blah…]

And I don’t really want those, either. Do those come from Gradle, and can I get rid of them?

(Todd Bradley) #2

Any suggestions about this? I can’t be the only person ever who has wanted Gradle to be less verbose when running tests, can I?

(Luke Daley) #3

Don’t use the built in logging and use your own output listener to forward error output:

(Todd Bradley) #4

Thanks, I’ll give that a try.

(Todd Bradley) #5

Well, I tried it, but it’s not doing what I hoped. My listener is getting called. But it’s not called on whatever causes these sort of events to be logged:

My Tests > My Tests STANDARD_OUT

And the standard out is still being printed to the screen even before my listener is called. I imagine this is because I’m just adding the listener, not replacing whatever listener is already in place, as the name of the method (addTestOutputListener) would imply.

Any ideas how to override either or both of those?


(Maciej Kwidziński) #6

Sorry for necroing, but @luke_daley’s tip fixed it for me. I couldn’t find this solution anywhere else.

@ToddBradley, you probably want to remove your test.testLogging.showStandardStreams = true or explicitly set it to false