@RetryingTest wraps AssertionFailedError, which prevents IntelliJ's "<Click to see difference>" from functioning #735
Labels
⚙️ component: Pioneer
Issues about Pioneer own things (e.g. utils)
🚦 status: in discussion
📖 theme: extensions
When using the
@RetryingTest
functionality of Junit Pioneer, anAssertionFailedError
will be thrown on the final invokation of the retrying test, with the previously failing tests throwing aTestAbortedException
.This approach works well, except for when the cause of test failure is an
AssertionFailedError
. In this scenario, the originalAssertionFailedError
will be wrapped inside of Pioneer'sAssertionFailedError
, as thecause
. On paper this sounds like a sensible approach to ensuring that the original assertion details are not lost, but whilst still providing additional details of the status of theRetryingTest
to the user.Practically, for users of IntelliJ, this nesting of
AssertionFailedError
will interfere with the ability to view assertion differences.Output from Regular
@Test
Output from
@RetryingTest
Summary of Differences
Between the two outputs, we can notice how on the
@RetryingTest
example, IntelliJ hasn't recognised the output as being an assertion difference, so IntelliJ hasn't provided the tooling to view the differences using the built-in tooling.Proposal
I believe that instead of throwing an
AssertionFailedError
from theRetryingTestExtension
, we should first inspect thecause
and if thecause
is also of typeAssertionFailedError
, then we should instead throw aMultipleFailuresError
that can include both the failure from@RetryingTest
and the originalAssertionFailedError
. IntelliJ should correctly recognise the assertion difference then from the original error.Extra Details
org.junit-pioneer:junit-pioneer:2.0.1
Contributions
I would be happy to attempt a pull request for this improvement providing that you agree with my assessment. Please let me know!
The text was updated successfully, but these errors were encountered: