https://bz.apache.org/bugzilla/show_bug.cgi?id=69687
--- Comment #7 from Björn Kautler <bjo...@kautler.net> --- > So it is not only legacy-xml, the other two legacy- formatters don't know how > to tell errors from failures either, I see. Yeah, any JUnit Platform Listener could / would be affected, but as you only have the legacy ones, they are it. I just did not test the others, so did not report about them. The other issues I reported against this formatter are also potentially for all of them of course, except the XML-specific ones. :-) > I can try to put something together this weekend, but don't promise anything. That's totally fine for me, thanks. I have a work-around in the meantime for this and tow of the other bugs I reported. Leaving it here for reference and in case it might be helpful for someone. It is written in Groovy as the Spock tests are written in Groovy anyway, and because it makes the delegate pattern super comfortable to use: ```groovy class JUnitXmlResultFormatter implements TestResultFormatter { @Delegate TestResultFormatter delegateFormatter = new LegacyXmlResultFormatter() OutputStream originalOut def capturingOut = new ByteArrayOutputStream() @Override void setDestination(OutputStream os) { originalOut = os delegateFormatter.setDestination(capturingOut) } @Override void executionFinished(TestIdentifier testIdentifier, TestExecutionResult testExecutionResult) { // work-around for https://bz.apache.org/bugzilla/show_bug.cgi?id=69707 testExecutionResult .throwable .filter { it instanceof MultipleFailuresError } .ifPresent { it.failures.each(it::addSuppressed) } delegateFormatter.executionFinished(testIdentifier, testExecutionResult) } @Override void testPlanExecutionFinished(TestPlan testPlan) { // part of work-around for https://bz.apache.org/bugzilla/show_bug.cgi?id=69683 if (delegateFormatter.numTestsSkipped.get() != 0) { throw new InvalidSpecException("Do not use an annotation that skips the test before execution starts, to get better reports. Use for example @IgnoreIf({ instance }) instead of @Ignore.") } // part of work-around for https://bz.apache.org/bugzilla/show_bug.cgi?id=69685 delegateFormatter.aborted.each { testIdentifier, throwable -> delegateFormatter.skipped.put(testIdentifier, throwable.map { it.message }) } delegateFormatter.numTestsSkipped.addAndGet(delegateFormatter.numTestsAborted.get()) delegateFormatter.aborted.clear() // part of work-around for https://bz.apache.org/bugzilla/show_bug.cgi?id=69687 delegateFormatter.failed.each { testIdentifier, throwable -> if (testIdentifier.isTest() && (throwable.orElse(null) !instanceof AssertionError)) { delegateFormatter.aborted.put(testIdentifier, throwable) } } delegateFormatter.aborted.keySet().each { delegateFormatter.failed.remove(it) } delegateFormatter.numTestsAborted.set(delegateFormatter.aborted.size()) delegateFormatter.numTestsFailed.addAndGet(-1 * delegateFormatter.aborted.size()) delegateFormatter.testPlanExecutionFinished(testPlan) originalOut.withWriter(UTF_8.name()) { it.write(new String(capturingOut.toByteArray(), UTF_8) .replace("<aborted>", "<error>") .replace("<aborted ", "<error ") .replace("</aborted>", "</error>") .replace(" aborted=", " errors=")) } } } ``` -- You are receiving this mail because: You are the assignee for the bug.