Support better failure tooling on jvm
BenWoodworth opened this issue · 0 comments
(other platforms don't have nice expected/actual comparison tooling to begin with, so this issue only aims to match support on jvm)
Currently in v0.1, parameterize failures are not reported as nicely as normal failures with tooling:
@Test
fun failure() {
assertEquals("expected", "actual")
}
@Test
fun parameterized_failure() = parameterize {
val parameter by parameterOf("argument")
useParameter(parameter)
assertEquals("expected", "actual")
}
Solution
IntelliJ and Eclipse (and likely others) lean on opentest4j and its standardized failure classes to pull out information for nicer reporting, supporting AssertionFailedError
to pick up expected/actual values for diffs, and MultipleFailuresError
to recursively pick up multiple assertions to be reported from one throwable. Code for their support can be found here:
- IntelliJ:
- Eclipse:
To be supported by these IDEs, ParameterizeFailedError
can be changed to extend MultipleFailuresError
on jvm, and give access to its recorded failures from getFailures()
. Note that IntelliJ and Eclipse don't search through causes and suppressed errors, so decorating the failure with parameter arguments (by wrapping it into another failure as the cause) will break the support. This means that getFailures()
should return a list of the actual errors that were thrown.
From what I can tell, there isn't a way to communicate the parameter arguments for each error to the tooling. At least, there isn't a dedicated class from opentest4j, or any special handling code from IntelliJ/Eclipse.