Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 303452 - [JUnit] JUnit view does not properly report errors
Summary: [JUnit] JUnit view does not properly report errors
Status: CLOSED DUPLICATE of bug 172256
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-21 22:02 EST by Steffen Pingel CLA
Modified: 2010-03-08 06:18 EST (History)
3 users (show)

See Also:


Attachments
fully expanded tree not showing all failures (33.47 KB, image/png)
2010-02-21 22:03 EST, Steffen Pingel CLA
no flags Details
finished tests not showing status (38.39 KB, image/png)
2010-02-21 22:04 EST, Steffen Pingel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steffen Pingel CLA 2010-02-21 22:02:59 EST
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
Comment 1 Steffen Pingel CLA 2010-02-21 22:03:54 EST
Created attachment 159732 [details]
fully expanded tree not showing all failures
Comment 2 Steffen Pingel CLA 2010-02-21 22:04:40 EST
Created attachment 159733 [details]
finished tests not showing status
Comment 3 Dani Megert CLA 2010-02-22 02:43:40 EST
Which JUnit do you use on the build path? Which JUnit launcher do you use. Please provide the exact versions.
Comment 4 Steffen Pingel CLA 2010-02-22 13:42:06 EST
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?
Comment 5 Dani Megert CLA 2010-02-23 03:26:47 EST
> 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?
Comment 6 Dani Megert CLA 2010-02-23 03:33:49 EST
>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
Comment 7 Steffen Pingel CLA 2010-02-23 04:43:04 EST
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;
	}
	
}
Comment 8 Steffen Pingel CLA 2010-02-23 04:53:28 EST
(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.
Comment 9 Markus Keller CLA 2010-03-08 06:18:45 EST
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 ***