FileDocCategorySizeDatePackage
TestPrinter.javaAPI DocAndroid 1.5 API3472Wed May 06 22:42:02 BST 2009android.test

TestPrinter

public class TestPrinter extends Object implements TestRunner.Listener, TestListener
Prints the test progress to stdout. Android includes a default implementation and calls these methods to print out test progress; you probably will not need to create or extend this class or call its methods manually. See the full {@link android.test} package description for information about getting test results. {@hide} Not needed for 1.0 SDK.

Fields Summary
private String
mTag
private boolean
mOnlyFailures
private Set
mFailedTests
Constructors Summary
public TestPrinter(String tag, boolean onlyFailures)



         
        mTag = tag;
        mOnlyFailures = onlyFailures;
    
Methods Summary
public voidaddError(junit.framework.Test test, java.lang.Throwable t)

        failed(test, t);
    
public voidaddFailure(junit.framework.Test test, junit.framework.AssertionFailedError t)

        failed(test, t);
    
public voidendTest(junit.framework.Test test)

        finished(test.toString());
        if (!mFailedTests.contains(test.toString())) {
            passed(test.toString());
        }
        mFailedTests.remove(test.toString());
    
public voidfailed(java.lang.String className, java.lang.Throwable exception)

        Log.i(mTag, "failed: " + className);
        Log.i(mTag, "----- begin exception -----");
        Log.i(mTag, "", exception);
        Log.i(mTag, "----- end exception -----");
    
private voidfailed(junit.framework.Test test, java.lang.Throwable t)

        mFailedTests.add(test.toString());
        failed(test.toString(), t);
    
public voidfinished(java.lang.String className)

        if (!mOnlyFailures) {
            Log.i(mTag, "finished: " + className);
        }
    
public voidpassed(java.lang.String className)

        if (!mOnlyFailures) {
            Log.i(mTag, "passed: " + className);
        }
    
public voidperformance(java.lang.String className, long itemTimeNS, int iterations, java.util.List intermediates)

        Log.i(mTag, "perf: " + className + " = " + itemTimeNS + "ns/op (done "
                + iterations + " times)");
        if (intermediates != null && intermediates.size() > 0) {
            int N = intermediates.size();
            for (int i = 0; i < N; i++) {
                TestRunner.IntermediateTime time = intermediates.get(i);
                Log.i(mTag, "  intermediate: " + time.name + " = "
                        + time.timeInNS + "ns");
            }
        }
    
public voidstartTest(junit.framework.Test test)

        started(test.toString());
    
public voidstarted(java.lang.String className)

        if (!mOnlyFailures) {
            Log.i(mTag, "started: " + className);
        }