| Summary: | [JUnit] No tests found when sub-packages should be run | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Neale Upstone <neale> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | RESOLVED WONTFIX | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | martinae |
| Version: | 3.3.2 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Neale Upstone
I tried to reproduce, but this seems to wrk for me:
- create a new project with JUnit 3 on the classpath
and a source folder 'src'
- create the following 3 test cases in 'src'
package a;
import junit.framework.TestCase;
public class A extends TestCase {
public void testFoo() throws Exception {
}
}
//----------------------
package a;
import junit.framework.TestCase;
public class R extends TestCase {
public void testFoo() throws Exception {
}
}
//----------------------
package b;
import junit.framework.TestCase;
public class B extends TestCase {
public void testFoo() throws Exception {
}
}
- select 'src', 'Run as JUnit Test': 3 tests run
- select package 'a', 'Run as JUnit Test': 2 tests run
- select package 'b', 'Run as JUnit Test': 1 test run
Can you add a reproducible case ?
Modifying your example, the following is the minimum:
- create a new project with JUnit 3 on the classpath
and a source folder 'src'
- create the following 3 test cases in 'src'
package org.eclipse;
import junit.framework.TestCase;
public class A extends TestCase {
public void testFoo() throws Exception {
}
}
- In Package Explorer's menu, set Package Presentation -> Hierarchical
- select 'src', 'Run as JUnit Test': 1 test runs
- select package 'org', 'Run as JUnit Test': Get error:
"no tests found with test runner 'JUnit 3'"
- select package 'org.eclipse', 'Run as JUnit Test': 1 test runs
OK, now I understand what you mean. The hierarchical mode is only a view. Actions always work on the model hierarchy. That's the same for all actions and all views. Ok. I understand that you probably have Project -> *Package as a model relationship, and if so, this should be reflected in the UI: The following are therefore bugs: - The UI for editing test case launchers allows me to select a package that the runner then ignores. - Run As -> JUnit Test, should not be available for a path, *unless* that path is a package. In both cases, the launch configuration should not be created without, at the very least, informing the user that there are no classes in the specified package. In your structure 'org' and 'eclipse' are both packages. 'org' happens to be empty. It could also be that 'eclipse' is empty or contains some Java files but doesn't contain any tests. This is more expensive to find out. I added a filter in the JUnit launch config dialog and the shortcut to avoid empty packages (released > 20080312) Sounds like a tick in the box for the "out of the box experience" theme. Thanks. Also, I've corrected the reported version, now that 3.3.2 has been made available in the versions box ;) |