Scalatest: On latest SBT (1.2.6) JUnit reporter can mangle output files

Created on 22 Oct 2018  路  4Comments  路  Source: scalatest/scalatest

Jenkins reporter then fails with:

Failed to read test report file /home/www/data/jenkins/jenkins_home/workspace/REDACTED/target/test-reports/TEST-com.foo.BarSpec.xml
org.dom4j.DocumentException: Error on line 12 of document  : Content is not allowed in trailing section. Nested exception: Content is not allowed in trailing section.

Examination of this file shows that some contents is written twice, as if two reporters tried to write to the same file without locking.

We've been using forked parallel testing for a while but only after upgrading to SBT 1.2.6 did the problem surface.
EDIT: The bug still shows after disabling forked parallel testing
EDIT2: The bug still shows after disabling forking.

Most helpful comment

For the record, disabling either SBT's built-in JUnitXmlReportPlugin or scalatest's JUnit XML reporter solved the issue.

All 4 comments

I believe the cause is a regression in SBT. https://github.com/sbt/sbt/pull/4400

Let me close this issue for now as there's nothing to be fixed in scalatest

For the record, disabling either SBT's built-in JUnitXmlReportPlugin or scalatest's JUnit XML reporter solved the issue.

Thanks to your comment, saved my time. I suggest writing the report using atomic write. Users should notice the redundancy in the reports anyway...

Arguably, an "experimental" plugin shouldn't be enabled by default. This could be considered a mistake from sbt.

Was this page helpful?
0 / 5 - 0 ratings