[ https://issues.apache.org/jira/browse/SUREFIRE-1821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17324591#comment-17324591 ]
Pavel Pustovoyt commented on SUREFIRE-1821: ------------------------------------------- [~tibordigana] StatelessXmlReporter doesn't throw the exception but dumps it into the file: {code:java} Created at 2021-04-18T22:14:19.101# Created at 2021-04-18T22:14:19.101When writing xml report stdout/stderrorg.apache.maven.surefire.api.report.ReporterException: When writing xml report stdout/stderr at org.apache.maven.plugin.surefire.report.StatelessXmlReporter.addOutputStreamElement(StatelessXmlReporter.java:508) at org.apache.maven.plugin.surefire.report.StatelessXmlReporter.createOutErrElements(StatelessXmlReporter.java:483) at org.apache.maven.plugin.surefire.report.StatelessXmlReporter.serializeTestClassWithRerun(StatelessXmlReporter.java:261) at org.apache.maven.plugin.surefire.report.StatelessXmlReporter.serializeTestClass(StatelessXmlReporter.java:207) at org.apache.maven.plugin.surefire.report.StatelessXmlReporter.testSetCompleted(StatelessXmlReporter.java:152) at org.apache.maven.plugin.surefire.report.StatelessXmlReporter.testSetCompleted(StatelessXmlReporter.java:51) at org.apache.maven.plugin.surefire.report.TestSetRunListener.testSetCompleted(TestSetRunListener.java:193) at org.apache.maven.plugin.surefire.booterclient.output.ForkClient$TestSetCompletedListener.handle(ForkClient.java:139) at org.apache.maven.plugin.surefire.booterclient.output.ForkClient$TestSetCompletedListener.handle(ForkClient.java:128) at org.apache.maven.plugin.surefire.booterclient.output.ForkedProcessEventNotifier.notifyEvent(ForkedProcessEventNotifier.java:232) at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.handleEvent(ForkClient.java:361) at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.handleEvent(ForkClient.java:57) at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer$Pumper.run(ThreadedStreamConsumer.java:91) at java.lang.Thread.run(Thread.java:748)Caused by: java.io.FileNotFoundException: /var/folders/wz/5hl931hj1ml_k_p4_f_x1hq1lwp2d4/T/stdout5335614658614860966deferred (No such file or directory) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.<init>(FileInputStream.java:138) at org.apache.maven.surefire.shared.io.output.DeferredFileOutputStream.writeTo(DeferredFileOutputStream.java:321) at org.apache.maven.plugin.surefire.report.Utf8RecodingDeferredFileOutputStream.writeTo(Utf8RecodingDeferredFileOutputStream.java:85) at org.apache.maven.plugin.surefire.report.StatelessXmlReporter.addOutputStreamElement(StatelessXmlReporter.java:502) ... 13 more {code} > Broken junit report when parallel and rerunFailingTestsCount configureation > is used > ----------------------------------------------------------------------------------- > > Key: SUREFIRE-1821 > URL: https://issues.apache.org/jira/browse/SUREFIRE-1821 > Project: Maven Surefire > Issue Type: Bug > Components: Junit 4.7+ (parallel) support, Maven Failsafe Plugin, > Maven Surefire Plugin > Affects Versions: 2.20.1, 2.22.2, 3.0.0-M5 > Reporter: Pavel Pustovoyt > Priority: Major > > *Description:* > When using *parallel* configuration with *rerunFailingTestsCount* bad xml > report is generated for a failing test. > *How to reproduce:* > 1. Configure forkCount, parallel and rerun count: > {code:java} > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-surefire-plugin</artifactId> > <version>3.0.0-M5</version> > <executions> > <execution> > <goals> > <goal>test</goal> > </goals> > </execution> > </executions> > <configuration> > <rerunFailingTestsCount>1</rerunFailingTestsCount> > <forkCount>1</forkCount> > <threadCount>1</threadCount> > <parallel>all</parallel> > <redirectTestOutputToFile>true</redirectTestOutputToFile> > </configuration> > </plugin> > {code} > 2. Create a failing test that outputs more than 1m characters: > {code:java} > public class AppTest { > @Test > public void testBug() { > for(int i = 0; i < 100000; i++){ > System.out.println("Some output longer than 10 character"); > } > throw new NullPointerException(); > } > } > {code} > 3. Run the test and check the report - you will see unexpected end of xml > file: > {code:java} > ... > <property name="sun.io.unicode.encoding" value="UnicodeBig"/> > <property name="java.class.version" value="52.0"/> > </properties> > <testcase name="testBug" classname="com.mycompany.app.AppTest" time="0.015"> > <error > type="java.lang.NullPointerException"><![CDATA[java.lang.NullPointerException > at com.mycompany.app.AppTest.testBug(AppTest.java:12) > ]]></error> > <system-out><![CDATA[ <-- EOF > {code} > *Possible cause:* > It seems that Junit 4.7 Runner considers each rerun as a separate test set, > so sends _testSetCompleted_ event each time, but after the first event > _DeferredFileOutputStream_ and associated with it temp file gets > freed(deleted), however _testSetCompleted_ event for rerun still tries to > write something there. If temp file isn't yet created (still in memory) then > there will be no bug and it gets created only after 1m characters were > written to the stream. I wasn't able to understand wether multiple > _testSetCompleted_ events is a bug here or a "rerun" trying to write to > _DeferredFileOutputStream_ of initial test run. > > *Project to reproduce:* > *[https://github.com/himos/surefire-report-bug]* -- This message was sent by Atlassian Jira (v8.3.4#803005)