Bug 35933 JUnit package test runner doesn't find empty tests [JUnit]
The JUnit package test runner doesn't run TestCases that don't contain any test* methods themselves (but instead only inherit them). Consider the following example: public class SimpleTest extends TestCase { public void testParser() { Parser p = getParser(); assert(...); } protected Parser getParser() { return new SimpleParser(); } } // Not executed, unless a dummy test method is inserted! public class ExtendedTest extends SimpleTest { protected Parser getParser() { return new ExtendedParser(); } }
org.eclipse.jdt.junit.core/src/org/eclipse/jdt/internal/junit/util/TestSearchEngine.java
}
			return (IType[]) result.toArray(new IType[result.size()]) ;
	}
	public static IType[] findTests(final Object[] elements) throws InvocationTargetException, InterruptedException{
		final Set result= new HashSet();
	
		if (elements.length > 0) {
			IRunnableWithProgress runnable= new IRunnableWithProgress() {
				public void run(IProgressMonitor pm) throws InterruptedException {
					doFindTests(elements, result, pm);
				}
			};
			PlatformUI.getWorkbench().getProgressService().busyCursorWhile(runnable);			
		}
		return (IType[]) result.toArray(new IType[result.size()]) ;
	}
	public static void doFindTests(Object[] elements, Set result, IProgressMonitor pm) throws InterruptedException {
		int nElements= elements.length;
		pm.beginTask(JUnitMessages.getString("TestSearchEngine.message.searching"), nElements);  
		try {
			for (int i= 0; i < nElements; i++) {
				try {
					collectTypes(elements[i], new SubProgressMonitor(pm, 1), result);
				} catch (CoreException e) {
					JUnitPlugin.log(e.getStatus());
				}
				if (pm.isCanceled()) {
					throw new InterruptedException();
				}
			}