Community
Participate
Working Groups
Mylyn constructs a test suite that contains the same test class (and test methods) several times to run it against different configurations. Since 3.6M4 (?) the JUnit view does not properly report progress or failures anymore when the test suite is executed. Some nodes don't show status and execution time at all when tests are finished and filtering to show failures only does not work reliably (see screenshots). Eclipse SDK Version: 3.6.0 Build id: I20100129-1300
Created attachment 159732 [details] fully expanded tree not showing all failures
Created attachment 159733 [details] finished tests not showing status
Which JUnit do you use on the build path? Which JUnit launcher do you use. Please provide the exact versions.
The plug-in has a "Require-Bundle: org.junit". The Test runner is configured as JUnit 4. The About dialog shows org.junit 4.8.1.v4_8_1_v20100114-1600 and org.junit 4.7.0.v20100104. Looks like setting the runner to JUnit 3 fixes it. Has the default for launch configurations changed from JUnit 3 to 4 in a recent milestone if a plug-in does not specify version constraints on requiring org.junit?
> The About dialog shows org.junit 4.8.1.v4_8_1_v20100114-1600 and >org.junit 4.7.0.v20100104. 4.7.0.v20100104 rather belongs to 'org.junit4' and not 'org.junit' and there should also be an 'org.junit' 3.8.something, right? Given the build path shows 'org.junit' only, I suspect that you have 'org.junit' imported in your workspace. What version?
>Looks like setting the runner to JUnit 3 fixes it. Has the default for launch >configurations changed from JUnit 3 to 4 in a recent milestone if a plug-in >does not specify version constraints on requiring org.junit? See http://download.eclipse.org/eclipse/downloads/drops/S-3.6M4-200912101301/eclipse-news-M4.html#org.junit-plugins
Here is a simple test suite to reproduce the described behavior: import junit.framework.Test; public class NestedSuite { public static class NestedTest extends TestCase { public void testOne() { } } public static Test suite() { TestSuite suite = new TestSuite(); for (int i = 0; i < 3; i++) { TestSuite nestedSuite = new TestSuite(); nestedSuite.addTestSuite(NestedTest.class); suite.addTest(nestedSuite); } return suite; } }
(In reply to comment #5) > > The About dialog shows org.junit 4.8.1.v4_8_1_v20100114-1600 and > >org.junit 4.7.0.v20100104. > 4.7.0.v20100104 rather belongs to 'org.junit4' and not 'org.junit' and there > should also be an 'org.junit' 3.8.something, right? Yes, sorry, it's org.junit4 4.7.0.v20100104 and there is org.junit 3.8.2.v20090203-1005 as well. > Given the build path shows 'org.junit' only, I suspect that you have 'org.junit' > imported in your workspace. What version? I don't have org.junit in the workspace. I just now realized that this is not a new bug in any way but I can reproduce it even with Eclipse 3.4 if I run the test suite from comment 7 as a JUnit test. I assumed this was a new bug because I was only seeing it on 3.6 not realizing that I had created a new launch configuration which defaulted to using JUnit 4 as the test runner whereas in M3 and earlier JDT would always select JUnit 3 as the test runner and I had only run existing launch configurations before updating to M5.
JUnit 4 fails if the same test is included multiple times, see bug 172256. When you just have a "Require-Bundle: org.junit", you will get JUnit 4 now. To stay with JUnit 3, add a version bound, or manually choose the JUnit 3 runner. See also http://wiki.eclipse.org/Eclipse/Testing/JUnit4_Changes . *** This bug has been marked as a duplicate of bug 172256 ***