https://bz.apache.org/bugzilla/show_bug.cgi?id=69707

            Bug ID: 69707
           Summary: org.opentest4j.MultipleFailuresError is not handled
                    well in junitlauncher reporting
           Product: Ant
           Version: 1.10.15
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Core
          Assignee: notifications@ant.apache.org
          Reporter: bjo...@kautler.net
  Target Milestone: ---

If you have a test that throws a `org.opentest4j.MultipleFailuresError`, like a
Spock specification with `@Retry` annotation that is failing, the report is
very unhelpful.

It only shows the `org.opentest4j.MultipleFailuresError` itself.
This contains the messages of the wrapped failures, but it completely misses
its stacktraces and causes which often is essential to see where the error
happened and what happened.

If you for example also use Geb and there use a `waitFor {...}` that is
failing, you end up with
```plain
org.opentest4j.MultipleFailuresError: Multiple Failures (2 failures)
geb.waiting.WaitTimeoutException: condition did not pass in 10 seconds (failed
with exception)
geb.waiting.WaitTimeoutException: condition did not pass in 10 seconds (failed
with exception)
```
and a stacktrace only consisting of Spock classes without any trace of your
test class.

Other consumers like Gradle and IntelliJ IDEA have a special handling of this
type of error, displaying the wrapped failures with their stacktraces and
causes.

If you for example use the `LegacyXmlResultFormatter`, and then the
`junitreport` task, you only get the pretty unhelpful output described above.

So special handling for such exceptions should be added everywhere relevant,
like for example the `LegacyXmlResultFormatter`. The most trivial
implementation would be to modify the `executionFinished` implementation, so
that if a throwable is present in the `testExecutionResult` and it is a
`MultipleFailuresError`, its `failures` get added as `suppressed` exceptions,
and if any of the failures is again a `MultipleFailuresError` do the same and
so on.

Then the exception renderer will render the suppressed exceptions including
causes and stracktraces to the result file and then to the report.
I tried this with a custom listener that does exactly this modification and
then delegates to the `LegacyXmlResultFormatter` and it works fine so far.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to