Community
Participate
Working Groups
Build ID: I20080617-2000 Steps To Reproduce: To generate an Ant buildfile that contains the project's JUnit tests for bug 222615 we need a public API method for test searching. Currently I use internal code: new org.eclipse.jdt.internal.junit.launcher.JUnit4TestFinder().findTestsInContainer(container, result, null); More information:
No plans to work on this but would look at high quality patch. The new API has to be very thing, e.g. not just go and make JUnit4TestFinder API.
There is no need to make JUnit4TestFinder completely available. It would be sufficient to put this method to a public interface: public static IType[] findTestsInContainer(String containerHandle) throws CoreException { IJavaElement container = JavaCore.create(containerHandle); if (container == null) { return new IType[0]; } final Set result = new HashSet(); JUnit4TestFinder finder = new JUnit4TestFinder(); finder.findTestsInContainer(container, result, null); return (IType[]) result.toArray(new IType[result.size()]) ; }
Fixed in HEAD, see org.eclipse.jdt.junit.JUnitCore.findTestTypes(IJavaElement, IProgressMonitor).
Verified in I20090310-0100.