[ https://issues.apache.org/jira/browse/SUREFIRE-1603?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tibor Digana updated SUREFIRE-1603: ----------------------------------- Labels: junit5 (was: ) > Pass TestReporter entries to the reports generated by Surefire > -------------------------------------------------------------- > > Key: SUREFIRE-1603 > URL: https://issues.apache.org/jira/browse/SUREFIRE-1603 > Project: Maven Surefire > Issue Type: Improvement > Components: JUnit 5.x support > Affects Versions: 2.22.1, 3.0.0-M1 > Reporter: John Knight > Priority: Minor > Labels: junit5 > Fix For: Backlog > > > Using JUnit 5.31 with the following configuration: > {noformat} > <configurationParameters> > junit.jupiter.execution.parallel.enabled = true > junit.jupiter.execution.parallel.config.dynamic.factor = 8 > junit.jupiter.extensions.autodetection.enabled = true > </configurationParameters>{noformat} > and the following tests (for demonstration purposes) > {noformat} > public class AppTest > { > @Test > public void mogbyTrue() > { > for (int i = 0; i < 5; i++) { > System.out.println("mogby " + Thread.currentThread().getName()); > } > assertTrue( false ); > } > @Test > public void kermitTrue() > { > for (int i = 0; i < 5; i++) { > System.out.println("kermit " + Thread.currentThread().getName()); > } > assertTrue( false ); > }{noformat} > When the tests are executed via mvn test, the messages from both tests appear > under the output for the first test: > {noformat} > <testcase name="mogbyTrue" classname="com.foo.logtest.AppTest" time="0.013"> > <failure message="expected: ... > </failure> > <system-out><![CDATA[mogby ForkJoinPool-1-worker-43 > kermit ForkJoinPool-1-worker-50 > mogby ForkJoinPool-1-worker-43 > kermit ForkJoinPool-1-worker-50 > mogby ForkJoinPool-1-worker-43 > kermit ForkJoinPool-1-worker-50 > mogby ForkJoinPool-1-worker-43 > kermit ForkJoinPool-1-worker-50 > mogby ForkJoinPool-1-worker-43 > kermit ForkJoinPool-1-worker-50 > ]]></system-out> > </testcase>{noformat} > If I change the code to use TestReporter.publishEntry(), the messages don't > make their way into the surefire reports at all. > If I configure Capturing stdout - > [https://junit.org/junit5/docs/snapshot/user-guide/#running-tests-capturing-output] > - The output for both tests is still captured within the <system-out> field > of the first test, but in a different order: > {noformat} > <system-out><![CDATA[kermit ForkJoinPool-1-worker-50 > kermit ForkJoinPool-1-worker-50 > kermit ForkJoinPool-1-worker-50 > kermit ForkJoinPool-1-worker-50 > kermit ForkJoinPool-1-worker-50 > mogby ForkJoinPool-1-worker-43 > mogby ForkJoinPool-1-worker-43 > mogby ForkJoinPool-1-worker-43 > mogby ForkJoinPool-1-worker-43 > mogby ForkJoinPool-1-worker-43 > ]]></system-out>{noformat} > The original use case for this, is that we have a whole suite of tests > running via Jenkins, so when tests fail, it's really difficult to see what > the actual problem is, as the logging is out of sync. -- This message was sent by Atlassian Jira (v8.3.4#803005)