Bug 243294 - [JUnit][api] Need public API to provide JUnit test searching
Summary: [JUnit][api] Need public API to provide JUnit test searching
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P2 enhancement (vote)
Target Milestone: 3.5 M6   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords: api, helpwanted
Depends on:
Blocks: 222615
  Show dependency tree
 
Reported: 2008-08-06 08:51 EDT by Richard . CLA
Modified: 2009-03-10 06:29 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard . CLA 2008-08-06 08:51:24 EDT
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:
Comment 1 Dani Megert CLA 2008-08-06 09:33:29 EDT
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.
Comment 2 Richard . CLA 2008-08-07 05:12:57 EDT
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()]) ;
}
Comment 3 Markus Keller CLA 2009-03-09 07:25:48 EDT
Fixed in HEAD, see
org.eclipse.jdt.junit.JUnitCore.findTestTypes(IJavaElement, IProgressMonitor).
Comment 4 Dani Megert CLA 2009-03-10 06:29:37 EDT
Verified in I20090310-0100.