Community
Participate
Working Groups
I am getting the following error when running a JUnit test suite in Eclipse 3.2: java.lang.Exception: Unexpected TestElement type for testId '66': null at org.eclipse.jdt.internal.junit.model.TestRunSession$TestSessionNotifier.logUnexpectedTest(TestRunSession.java:493) at org.eclipse.jdt.internal.junit.model.TestRunSession$TestSessionNotifier.testEnded(TestRunSession.java:397) at org.eclipse.jdt.internal.junit.model.RemoteTestRunnerClient$4.run(RemoteTestRunnerClient.java:484) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.jdt.internal.junit.model.RemoteTestRunnerClient.notifyTestEnded(RemoteTestRunnerClient.java:481) at org.eclipse.jdt.internal.junit.model.RemoteTestRunnerClient.access$7(RemoteTestRunnerClient.java:476) at org.eclipse.jdt.internal.junit.model.RemoteTestRunnerClient$DefaultProcessingState.readMessage(RemoteTestRunnerClient.java:90) at org.eclipse.jdt.internal.junit.model.RemoteTestRunnerClient.receiveMessage(RemoteTestRunnerClient.java:342) at org.eclipse.jdt.internal.junit.model.RemoteTestRunnerClient.access$26(RemoteTestRunnerClient.java:341) at org.eclipse.jdt.internal.junit.model.RemoteTestRunnerClient$ServerConnection.run (RemoteTestRunnerClient.java:267) I am using the latest version of eclipse and junit 3.8.1 I noticed that a bug has already been loogged for this issue (https://bugs.eclipse.org/bugs/show_bug.cgi?id=129725), but I am getting this error with the latest version of elipse. Any suggestions?
I looked at the code again, and I really don't see how this could happen in 3.2. Could you please verify that you're really running on build M20060629-1905? Can you reproduce when you run the suite again? Could you attach the test suite or strip it down to a sufficient example to reproduce? Or could it be that you have an old version of org.eclipse.jdt.junit.runtime in your workspace?
Created attachment 47904 [details] Sample test suite
I am using the latest eclipse build: eclipse.buildId=M20060629-1905 java.version=1.5.0_07 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US Command-line arguments: -os win32 -ws win32 -arch x86 !ENTRY org.eclipse.jdt.junit 4 4 2006-08-14 16:36:48.441 !MESSAGE Error !STACK 0 java.lang.Exception: Unexpected TestElement type for testId '77073': null at org.eclipse.jdt.internal.junit.model.TestRunSession$TestSessionNotifier.logUnexpectedTest(TestRunSession.java:493) I do not see any org.eclipse.jdt.junit.runtime in my workspace. I have org.eclipse.jdt.junit only in the .metadata folder. I attached the sample test suite. In the classpath for my project, I am using junit 3.8.1, and this test suite was working fine on eclipse 3.1. The problem is only happening since I upgraded to eclipse 3.2
Created attachment 48264 [details] Self-contained example The problem is the unusual way of collecting tests. The example does not create the usual tree of TestSuites and TestCases, but creates a suite in the run(TestResult) method. This makes it impossible for the Eclipse JUnit implementation to find the test tree. Need to see what we can do to support this case (e.g. just list all "unknown" failed test elements under the root node), or whether this setup has to be declared unsupported. Note that the example as given violates at least the contract of TestCase#countTestCases(). In 3.1, only the failures tab worked - the model tab stayed empty.
Created attachment 50380 [details] Patch I've released the attached workaround for the upcoming 3.3 M2.
Problem has been fixed for 3.3. Keeping this bug open to add a regression test in 3.4
Has the regression test been added? Lowering the priority since all that's left is to add the test.
(In reply to comment #7) > Has the regression test been added? Yes, today ;-). See TestRunListenerTest#testTreeUnrootedEnded().