| Summary: | [JUnit] org.junit.runner.notification.StoppedByUserException is treated as an application error | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Olivier Thomann <Olivier_Thomann> | ||||||
| Component: | UI | Assignee: | Markus Keller <markus.kell.r> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | cho, daniel_megert, david, kos32, markus.kell.r, raksha.vasisht | ||||||
| Version: | 3.7 | ||||||||
| Target Milestone: | 3.7 M4 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Olivier Thomann
Created attachment 182467 [details]
Screenshot of the dialog I get when I stop the tests
Design bug in JUnit 4. A client who called org.junit.runner.notification.RunNotifier#pleaseStop() is likely not interested in getting an undocumented exception from its call to org.junit.runner.Runner#run(RunNotifier). Released a workaround to RemoteTestRunner. This causes test failures in: org.eclipse.jdt.junit.tests.LegacyTestRunListenerTest org.eclipse.jdt.junit.tests.TestRunListenerTest Created attachment 184107 [details] Fix 2 The problem with the first fix was that org.eclipse.jdt.junit.runtime should not see JUnit 4, so I didn't get a compile error for the illegal reference to org.junit.runner.notification.StoppedByUserException (which blows up at run time when only JUnit 3 is available). See PDE bug 290533 and bug 177629. Fixed in HEAD. . Comment on attachment 184107 [details]
Fix 2
Grr, the patch "Fix 2" is missing the change in org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.
This seems to have broken running JUnit testcases for me in 3.7 RC6. This is caused by the StoppedByUserException, which was removed in JUnit 4.5+. The class can then not be found when running the tests. The stacktrace is the following: java.lang.NoClassDefFoundError: org/junit/runner/notification/StoppedByUserException at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: java.lang.ClassNotFoundException: org.junit.runner.notification.StoppedByUserException at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 6 more The import is in http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.jdt.junit4.runtime/src/org/eclipse/jdt/internal/junit4/runner/JUnit4TestReference.java?revision=1.7&view=markup (In reply to comment #7) > This seems to have broken running JUnit testcases for me in 3.7 RC6. 3.7 RC6 is not an Eclipse build. > This is > caused by the StoppedByUserException, which was removed in JUnit 4.5+. That's wrong, StoppedByUserException has been a available in all JUnit versions since 4.0 (up to 4.8.2). If you can reproduce your problem with 3.7 M7 or later, the please file a new bug and add steps to reproduce. > If you can reproduce your problem with 3.7 M7 or later, > the please file a new bug and add steps to reproduce. bug 363131 created |