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

Bug 334864

Summary: [JUnit] Opening @Ignored test classes from JUnit view leads to "Method '...' not found. Opening the test class." warning
Product: [Eclipse Project] JDT Reporter: Sebastian Dietrich <Sebastian.Dietrich>
Component: UIAssignee: Markus Keller <markus.kell.r>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, david, markus.kell.r
Version: 3.6.1   
Target Milestone: 3.7 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Workaround none

Description Sebastian Dietrich CLA 2011-01-20 04:23:08 EST
Build Identifier:  20100917-0705

I have some JUnit 4 unit tests where I've marked the whole class with @Ignore. This gives a (correct) output on the JUnit view.
If I want to open those tests via double-click in the JUnit view, I get a "Method '...' not found. Opening the test class." warning. This is not ok, since I never indended to open a method but the whole class. Clicking on ok opens the class (which is again ok)
--> please don't show that warning in that case since it makes no sense

Reproducible: Always

Steps to Reproduce:
1. write a Junit 4 unit test
2. mark the whole class with @Ignore
3. run your tests
4. double-click on the ignored test in the Junit view
Comment 1 Markus Keller CLA 2011-01-24 18:06:39 EST
That's a bug in the JUnit 4 model.

In JUnit4TestClassReference#sendDescriptionTree(IVisitsTestTrees, Description), we call org.junit.runner.Description#isTest(), which returns true for an ignored class (because it has no children).


package testcase;

import org.junit.Ignore;
import org.junit.Test;

@Ignore
public class T4 {
    @Test
    public void myTest() throws Exception {
        org.junit.Assert.assertEquals("the expected String",
"the actual String");
    }
    @Test
    public void anotherTest() throws Exception {
        junit.framework.Assert.assertEquals("the expected String",
"the actual String");
    }
}
Comment 2 Markus Keller CLA 2011-01-24 18:07:04 EST
Created attachment 187482 [details]
Workaround
Comment 3 Markus Keller CLA 2011-01-31 06:22:45 EST
Fixed in HEAD.