-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Capture stdout/stderr and include in test reports #780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thinking about this... where would the captured output go? Into the report? |
I think we would have to make the captured output available in In addition, we could consider making the same data available to extensions in JUnit Jupiter, much akin to the OutputCapture rule for JUnit 4 in Spring Boot. |
I've got a couple of extensions for testing methods that interact with stdio that I'm going to move into junit-pioneer. For System.out and System.err, the test can capture the method's outputs and make assertions against that output. the interplay between the proposed feature (which is ostensibly writing log messages to one of these output streams and an application which is naturally writing to the "console" could be "very interesting". |
If concurrent test execution becomes supported then stdout/stderr will have much less value. I like how |
FYI: as a proof of concept, I ported the JUnit 4 based |
releated? #1166 |
Currently in progress as part of #60. |
#60 was closed. What about this issue @marcphilipp? |
Good question. Technically speaking, the information is now available to report generators via But... developers can obviously generate a custom report by implementing their own So I'm guessing we could close this issue. However, we still may wish to address the lacking ability to access stderr and stdout in Jupiter tests, potentially via an extension in JUnit Pioneer. Thoughts? |
I think we should properly include it in the XML report, if capturing is enabled, before closing this issue. |
What do you mean by "properly"? 😉 We already include all report entries in the |
Tentatively slated for 5.3 RC1 in light of #60. |
We could use a separate |
SGTM. Thanks for expounding. |
@marcphilipp Can this be integrated into the official Gradle Plugin somehow? What is the overhead required to achieve this? |
The official Gradle plugin does currently not even support parallel test execution... I think we should fix that first. 😉 |
If capturing output to `System.out`/`System.err` is enabled, it is now written into the `system-out`/`system-err` XML elements and excluded from the output for other report entries, if any. In addition, this commit slightly revises the existing output to `system-out` elements: - Now they are always written using CDATA sections. - The non standard unique-id/display-name `system-out` element always comes first. - If there are normal report entries, another `system-out` element is written next. - If there was output captured to `System.out`, another `system-out` element is written and always comes last. Resolves junit-team#780.
Overview
Currently the JUnit Platform and JUnit Jupiter do not support capturing stdout/stderr emitted during tests. This is quite useful for troubleshooting test failures on CI servers, esp. if the failures are not reproducible locally.
Background: http://stackoverflow.com/questions/43151448/how-to-capture-stdout-stderr-in-junit-5-gradle-test-report/43259526
The text was updated successfully, but these errors were encountered: