[GRADLE-1208] gradle test with JUnit 4 only reports cleanup failures when setup also failed Created: 04/Nov/10  Updated: 04/Jan/13  Resolved: 05/Dec/10

Status: Resolved
Project: Gradle
Affects Version/s: 0.9.1
Fix Version/s: 0.9

Type: Bug
Reporter: Charles Anderson Assignee: Hans Dockter
Resolution: Fixed Votes: 0

Attachments: File ExceptionSwallowing.groovy     Text File JavaExceptionSwallowing.java    

 Description   

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.


Generated at Wed Jun 30 11:49:44 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.