Skip to content
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

Introduce --redirect-stdout and --redirect-stderr CLI options to redirect STDOUT and STDERR #3637

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

mobounya
Copy link
Contributor

@mobounya mobounya commented Jan 14, 2024

Overview

Add new CLI options --redirect-stdout and --redirect-stderr to redirect stdout and stderr respectively to a file,
if both are set to the same file, stdout and stderr will be merged using the configuration parameter
CAPTURE_MERGED_STANDARD_STREAMS_PROPERTY_NAME and captured from stdout key STDOUT_REPORT_ENTRY_KEY in a new TestExecutionListener : RedirectStdoutAndStderrListener

Issue: #3166


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

@mobounya mobounya changed the title Feat redirect stderr and stdout Add new CLI options --redirect-stdout and --redirect-stderr to redirect stdout and stderr Jan 14, 2024
Add method registerMergedStandardStreams in StreamInterceptor to merge
stdout and stderr so both can be intercepted in an stdout interceptor.
This will keep the relative order for both outputs, which makes it
easier to correlate error messages with the corresponding output.

Add new configuration parameter junit.platform.output.capture.merge to
merge stdout and stderr and publish it as STDOUT_REPORT_ENTRY_KEY to
all registered TestExecutionListener instances.

Issue: junit-team#3166
Add new CLI options --redirect-stdout and --redirect-stderr to
redirect stdout and stderr to a file, if both are set to the same file,
stdout and stderr will be merged so we can keep the relative order of
messages. This makes it easier to correlate error messages with the
corresponding output.

Issue: junit-team#3166
Document the changes for the previous two commit in the 5.11.0-M1
release notes and in the user guide.

Issue: junit-team#3166
Add @API annotation to new methods.

Issue: junit-team#3166
@mobounya mobounya force-pushed the feat-redirect_stderr_and_stdout branch from 1dc0449 to ae0fce5 Compare January 14, 2024 14:35
@ahmedelbahri

This comment was marked as off-topic.

@sbrannen sbrannen changed the title Add new CLI options --redirect-stdout and --redirect-stderr to redirect stdout and stderr Introduce --redirect-stdout and --redirect-stderr CLI options to redirect STDOUT and STDERR Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow ConsoleLauncher to redirect STDOUT and STDERR to files instead of the console
3 participants