RFR: 7903324: Improve per-class reporting of JUnit tests, in .jtr file

Daniel Fuchs dfuchs at openjdk.org
Thu Oct 27 18:22:10 UTC 2022


On Tue, 27 Sep 2022 13:30:52 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Having said that, there's also: [Capturing Standard Output/Error](https://junit.org/junit5/docs/current/user-guide/#running-tests-capturing-output), an opt-in support for capturing output printed to `System.out` and `System.err`.
>>> If enabled, the JUnit Platform captures the corresponding output and publishes it as a report entry using the stdout or stderr keys to all registered [TestExecutionListener](https://junit.org/junit5/docs/current/api/org.junit.platform.launcher/org/junit/platform/launcher/TestExecutionListener.html) instances immediately before reporting the test or container as finished.
>> 
>> Shall we enable capturing standard streams by default?
>
> With TestNG, the "test $testname: $result" messages show up in the jtr System.out section. If a test prints anything then it will inlined and appear before the message emitted by TestNG. So this will take a bit of getting used to.

It's just a matter of remembering that testng uses System.out while junit uses System.err. If you use logging in your tests (either directly or by enabling logging for the lib you're using - e.g. http traces) then these traces will go to System.err. In some cases I had to go out of my way to configure the logging to go to System.out instead when using testng. So System.err is probably less surprising unless you come from testng ;-)

-------------

PR: https://git.openjdk.org/jtreg/pull/127


More information about the jtreg-dev mailing list