FileDocCategorySizeDatePackage
ListTestCaseNames.javaAPI DocAndroid 1.5 API3466Wed May 06 22:42:02 BST 2009android.test.suitebuilder

ListTestCaseNames

public class ListTestCaseNames extends Object

Fields Summary
Constructors Summary
Methods Summary
public static java.util.ListgetTestCaseNames(junit.framework.TestSuite suite)

        // TODO: deprecate this method and move all callers to use getTestNames
        List<Test> tests = Collections.<Test>list(suite.tests());
        ArrayList<String> testCaseNames = new ArrayList<String>();
        for (Test test : tests) {
            if (test instanceof TestCase) {
                testCaseNames.add(((TestCase) test).getName());
            } else if (test instanceof TestSuite) {
                testCaseNames.addAll(getTestCaseNames((TestSuite) test));
            }
        }
        return testCaseNames;
    
public static java.util.ListgetTestNames(junit.framework.TestSuite suite)
Returns a list of test class and method names for each TestCase in suite.

        List<Test> tests = Collections.<Test>list(suite.tests());
        ArrayList<TestDescriptor> testNames = new ArrayList<TestDescriptor>();
        for (Test test : tests) {
            if (test instanceof TestCase) {
                String className = test.getClass().getName();
                String testName = ((TestCase) test).getName();
                testNames.add(new TestDescriptor(className, testName));
            } else if (test instanceof TestSuite) {
                testNames.addAll(getTestNames((TestSuite) test));
            }
        }
        return testNames;