Is there a way to output test results(pass/fail) to stdout as tests are being executed?


(Phil Swenson) #1

Write now my test config looks like:

testLogging.showStandardStreams = true
    beforeTest { descriptor ->
        logger.lifecycle("--------------------------------------------------------------------------------------------------------------------------------------")
        logger.lifecycle("Running test: " + descriptor)
      }
    afterTest { descriptor ->
        logger.lifecycle("Finished test: " + descriptor)
    }

I like this, but I would like more…

I’d like for test results (pass/fail) to be presented as the tests are executed. And if the test fails, only then would I like to see the std out for that test

Is this doable?


(Peter Niederwieser) #2

You can get the result like this:

afterTest { descriptor, result -> ... }

See the DSL reference for the ‘Test’ task.

You’d have to buffer the output and show it only when a test fails. I guess it’s possible but can’t tell offhand how it works.

1.1 will be much more configurable in terms of test output logging, but it still won’t do “only show standard output for failed tests” out of the box.


(Phil Swenson) #3

thanks, I must have overlooked the 2nd param.