Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 145275

Summary: [JUnit] JUnit 4 backwards compatibility does not work with JUnit Plug-in Test
Product: [Eclipse Project] JDT Reporter: Tony Lam <tony.lam>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug
Attachments:
Description Flags
sample test file none

Description Tony Lam CLA 2006-06-05 01:11:06 EDT
I've tried to run a very simple JUnit 4 on JUnit 3 runner under Eclipse IDE (Eclipse 3.2 RC6):

*******************************************

package test.junit4;

import static org.junit.Assert.*;

import org.junit.Test;

import junit.framework.JUnit4TestAdapter;

public class JUnit4Test {

	@Test
	public void thisTest() {
		assertEquals(1, 1);
	}
	
	public static junit.framework.Test suite() {
		return new JUnit4TestAdapter(JUnit4Test.class);
	}
	
}

*******************************************

This class works fine if I launch this as JUnit under Eclipse.  This can be run with JUnit 3 or 4 test runner.

Now, I launch this test as JUnit Plug-in Test with JUnit 4 test runner.  So far so good.

Then I launch this with JUnit 3 test runner as JUnit Plug-in Test, and I receive the following error message:


!ENTRY org.eclipse.osgi 4 0 2006-06-05 05:10:10.994
!MESSAGE Application error
!STACK 1
java.lang.ClassCastException: junit.framework.JUnit4TestAdapter
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:106)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
	at org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java:58)
	at org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java:24)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
	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:585)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
	at org.eclipse.core.launcher.Main.run(Main.java:977)
	at org.eclipse.core.launcher.Main.main(Main.java:952)

This looks like JDT does not know the existance of JUnit4TestAdapter.
Comment 1 saurabh CLA 2007-05-01 12:30:32 EDT
Created attachment 65486 [details]
sample test file

This is a sample test case, i wish to run
Comment 2 saurabh CLA 2007-05-01 12:33:09 EDT
Pls ignore my comment and attachment. I added them accidently. They were intended for some other defect.
Comment 3 Eclipse Genie CLA 2019-10-07 03:56:34 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.