FileDocCategorySizeDatePackage
TestCollector.javaAPI DocAndroid 1.5 API4165Wed May 06 22:41:10 BST 2009com.android.ide.eclipse.adt.launch.junit.runtime

TestCollector

public class TestCollector extends Object implements com.android.ddmlib.testrunner.ITestRunListener
Collects info about tests to be executed by listening to the results of an Android test run.

Fields Summary
private int
mTotalTestCount
private Map
mTestTree
test name to test suite reference map.
private String
mErrorMessage
Constructors Summary
TestCollector()


     
        mTotalTestCount = 0; 
        mTestTree = new HashMap<String, TestSuiteReference>();
    
Methods Summary
public java.lang.StringgetErrorMessage()
Returns the error message that was reported when collecting test info. Returns null if no error occurred.

        return mErrorMessage;
    
public intgetTestCaseCount()
Returns the total test count in the test run.

        return mTotalTestCount;
    
public voidsendTrees(org.eclipse.jdt.internal.junit.runner.IVisitsTestTrees notified)
Sends info about the test tree to be executed (ie the suites and their enclosed tests)

param
notified the {@link IVisitsTestTrees} to send test data to

        for (ITestReference ref : mTestTree.values()) {
            ref.sendTree(notified);
        }
    
public voidtestEnded(com.android.ddmlib.testrunner.TestIdentifier test)

        // ignore
    
public voidtestFailed(TestFailure status, com.android.ddmlib.testrunner.TestIdentifier test, java.lang.String trace)

        // ignore - should be impossible since this is only collecting test information
    
public voidtestRunEnded(long elapsedTime)

        // ignore
    
public voidtestRunFailed(java.lang.String errorMessage)

        mErrorMessage = errorMessage;
    
public voidtestRunStarted(int testCount)

        mTotalTestCount = testCount;
    
public voidtestRunStopped(long elapsedTime)

        // ignore
    
public voidtestStarted(com.android.ddmlib.testrunner.TestIdentifier test)

        TestSuiteReference suiteRef = mTestTree.get(test.getClassName());
        if (suiteRef == null) {
            // this test suite has not been seen before, create it
            suiteRef = new TestSuiteReference(test.getClassName());
            mTestTree.put(test.getClassName(), suiteRef);
        }
        suiteRef.addTest(new TestCaseReference(test));