Community
Participate
Working Groups
When I stop some tests while they are running, I get a dialog saying that there is an application error. I think this should be silently handled as the user requested the run to stop. Using eclipse.buildId=I20101029-1118 (4.1 build) java.version=1.6.0_21 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=fr_CA Framework arguments: -version 3 -port 58270 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -classNames org.eclipse.pde.api.tools.tests.ApiToolsPluginTestSuite -application org.eclipse.pde.junit.runtime.coretestapplication -testpluginname org.eclipse.pde.api.tools.tests Command-line arguments: -os win32 -ws win32 -arch x86_64 -consoleLog -version 3 -port 58270 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -classNames org.eclipse.pde.api.tools.tests.ApiToolsPluginTestSuite -application org.eclipse.pde.junit.runtime.coretestapplication -data C:\eclipse\workspaces\head/../tests/ApiToolsPluginTestSuite -dev file:C:/eclipse/workspaces/head/.metadata/.plugins/org.eclipse.pde.core/pde-junit/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog -testpluginname org.eclipse.pde.api.tools.tests org.junit.runner.notification.StoppedByUserException at org.junit.runner.notification.RunNotifier.fireTestStarted(RunNotifier.java:83) at org.junit.internal.runners.JUnit38ClassRunner$OldTestClassAdaptingListener.startTest(JUnit38ClassRunner.java:35) at junit.framework.TestResult.startTest(TestResult.java:155) at junit.framework.TestResult.run(TestResult.java:107) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) 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.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:62) at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:621) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:576) at org.eclipse.equinox.launcher.Main.run(Main.java:1409) at org.eclipse.equinox.launcher.Main.main(Main.java:1385)
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