Skip to content

Commit

Permalink
Document output redirecion changes.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mobounya committed Jan 13, 2024
1 parent 781022b commit 3afe9a6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ repository on GitHub.
-- for use in third-party extensions and test engines.
* Error messages for type mismatches in `NamespacedHierarchicalStore` now include the
actual type and value in addition to the required type.

* New optional config parameter `junit.platform.output.capture.merge` that can be used to merge stdout and stderr and
capture it as stdout.
* New optional CLI options `--redirect-stdout` and `--redirect-stderr` to redirect stdout and stderr outputs to a file.

[[release-notes-5.11.0-M1-junit-jupiter]]
=== JUnit Jupiter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1019,14 +1019,17 @@ expressions can be useful.
Since version 1.3, the JUnit Platform provides opt-in support for capturing output
printed to `System.out` and `System.err`. To enable it, set the
`junit.platform.output.capture.stdout` and/or `junit.platform.output.capture.stderr`
<<running-tests-config-params, configuration parameter>> to `true`. And since version 5.11
you can capture a merged stdout/stderr output by setting the `junit.platform.output.capture.merge`
<<running-tests-config-params, configuration parameter>> to `true`. In addition, you may
configure the maximum number of buffered bytes to be used per executed test or container
using `junit.platform.output.capture.maxBuffer`.

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}` instances immediately before reporting the test or container as
finished.
finished, in case of a `junit.platform.output.capture.merge` <<running-tests-config-params, configuration parameter>>,
the merged output will be published as a report entry using the `stdout` key.

Please note that the captured output will only contain output emitted by the thread that
was used to execute a container or test. Any output by other threads will be omitted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private SummaryGeneratingListener registerListeners(PrintWriter out, Optional<Pa
launcher.registerTestExecutionListeners(summaryListener);
// optionally, register test plan execution details printing listener
createDetailsPrintingListener(out).ifPresent(launcher::registerTestExecutionListeners);
// optionally, register XML reports writingCAPTURE_STDERR_PROPERTY_NAME listener
// optionally, register XML reports writing listener
createXmlWritingListener(out, reportsDir).ifPresent(launcher::registerTestExecutionListeners);
return summaryListener;
}
Expand Down

0 comments on commit 3afe9a6

Please sign in to comment.