Skip to content

Commit 7f57d27

Browse files
committed
Improve validity of Junit XML reports
The Junit reports generated by scalatest are considered as invalid when using for instance these xsd: https://github.com/jenkinsci/xunit-plugin/blob/master/src/main/resources/org/jenkinsci/plugins/xunit/types/model/xsd/junit-10.xsd https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsd The problem is that we have "<property ... > </property>" instead of "<property ... />". This is why the Jenkins XUnit plugin does not accept reports from scalatest. This issue had already been raised (see issue scalatest#4 ). Next step would be to fix org.scala.xml.PrettyPrinter which transforms "<a .../>" to "<a ...>\n </a>" when the line is too long. It is possible that the option "minimizeEmpty" from scala/scala-xml#90 will completely fix the issue.
1 parent a56c6e2 commit 7f57d27

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

scalatest/src/main/scala/org/scalatest/tools/JUnitXmlReporter.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,7 @@ private[scalatest] class JUnitXmlReporter(directory: String) extends Reporter {
459459
<properties> {
460460
for (name <- propertyNames(sysprops))
461461
yield
462-
<property name={ name } value = { sysprops.getProperty(name) }>
463-
</property>
462+
<property name={ name } value = { sysprops.getProperty(name) } />
464463
}
465464
</properties>
466465
}

scalatest/src/main/scala/org/scalatest/tools/XmlReporter.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,7 @@ private[scalatest] class XmlReporter(directory: String) extends Reporter {
432432
<properties> {
433433
for (name <- propertyNames(sysprops))
434434
yield
435-
<property name={ name } value = { sysprops.getProperty(name) }>
436-
</property>
435+
<property name={ name } value = { sysprops.getProperty(name) } />
437436
}
438437
</properties>
439438
}

0 commit comments

Comments
 (0)