| Summary: | [JUnit] JUnit plugin can't run individual method if the method is in non static innerclass | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Joni Freeman <joni.freeman> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 3.3 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | stalebug | ||
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
To reproduce: public class InnerClassRunner extends Runner { private Description description; private final Class<?> innerClazz; public InnerClassRunner(Class<?> enclosingClass) { description = Description.createSuiteDescription(enclosingClass); // to simplify the issue, just take the first inner class this.innerClazz = enclosingClass.getClasses()[0]; Description innerClassDescription = Description.createSuiteDescription(innerClazz); description.addChild(innerClassDescription); for (Method method : innerClazz.getDeclaredMethods()) { innerClassDescription.addChild(Description.createTestDescription(innerClazz, method.getName())); } } @Override public Description getDescription() { return description; } @Override public void run(RunNotifier notifier) { for (Method method : innerClazz.getDeclaredMethods()) { Description desc = Description.createTestDescription(innerClazz, method.getName()); notifier.fireTestStarted(desc); // in real runner, run the test here notifier.fireTestFinished(desc); } } } @RunWith(InnerClassRunner.class) public class SomeTest { public class SomeInnerClass { @Test public void testMethod() { } } } Now run SomeTest as JUnit test. Everything works as expected. Then select 'testMethod' from JUnit view, right-click and select Run. The suite starts, the plugin notices that there's 1 test to be run. But the test is never run. This bug is related to already solved issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=184642