Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 334864 - [JUnit] Opening @Ignored test classes from JUnit view leads to "Method '...' not found. Opening the test class." warning
Summary: [JUnit] Opening @Ignored test classes from JUnit view leads to "Method '...' ...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M6   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-20 04:23 EST by Sebastian Dietrich CLA
Modified: 2011-01-31 06:22 EST (History)
3 users (show)

See Also:


Attachments
Workaround (2.53 KB, patch)
2011-01-24 18:07 EST, Markus Keller CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.