Given a JUnit 4 test with both setup and cleanup functions, if both of them fail, gradle only reports that the cleanup function failed. This can be very confusing because it leads the test writer to think that setup passed, which can make debugging the cleanup failure very difficult. (In my original case, the failure in setup was creating a situation that caused cleanup to fail, but since I was assuming that setup passed (no report otherwise), I couldn't understand why cleanup was failing.)
JUnit 4's test runner, Maven 2, and IDEA all report failures of both setup and cleanup. Gradle is only reporting the failure in cleanup.
I originally found this with a (Spock) test in Groovy, but I've confirmed it with straight JUnit4 tests in Groovy and Java - see attachments.
|