ITestRunListener

public interface ITestRunListener

com.android.ddmlib.testrunner.ITestRunListener


Receives event notifications during instrumentation test runs.

Patterned after org.junit.runner.notification.RunListener

The sequence of calls will be:

  • testRunStarted
  • testStarted
  • [testFailed]
  • [testAssumptionFailure]
  • [testIgnored]
  • testEnded
  • ....
  • [testRunFailed]
  • testRunEnded

Summary

Public methods

abstract void testAssumptionFailure(TestIdentifier test, String trace)

Called when an atomic test flags that it assumes a condition that is false

abstract void testEnded(TestIdentifier test, testMetrics)

Reports the execution end of an individual test case.

abstract void testFailed(TestIdentifier test, String trace)

Reports the failure of a individual test case.

abstract void testIgnored(TestIdentifier test)

Called when a test will not be run, generally because a test method is annotated with org.junit.Ignore.

abstract void testRunEnded(long elapsedTime, runMetrics)

Reports end of test run.

abstract void testRunFailed(String errorMessage)

Reports test run failed to complete due to a fatal error.

abstract void testRunStarted(String runName, int testCount)

Reports the start of a test run.

abstract void testRunStopped(long elapsedTime)

This method is deprecated. This callback is never be invoked. To be deleted.

abstract void testStarted(TestIdentifier test)

Reports the start of an individual test case.

Public methods

testAssumptionFailure

public abstract void testAssumptionFailure (TestIdentifier test, 
                String trace)

Called when an atomic test flags that it assumes a condition that is false

Parameters
test TestIdentifier: identifies the test

trace String: stack trace of failure

testEnded

public abstract void testEnded (TestIdentifier test, 
                 testMetrics)

Reports the execution end of an individual test case.

If testFailed(TestIdentifier, String) was not invoked, this test passed. Also returns any key/value metrics which may have been emitted during the test case's execution.

Parameters
test TestIdentifier: identifies the test

testMetrics : a ERROR(/Map) of the metrics emitted during the execution of the test case by android.app.Instrumentation#sendStatus. The insertion order is preserved unless you emit a same key multiple times. Note that standard keys defined in IInstrumentationResultParser.StatusKeys are filtered out of this Map. Ddmlib may add extra test metrics defined in IInstrumentationResultParser.StatusKeys.

testFailed

public abstract void testFailed (TestIdentifier test, 
                String trace)

Reports the failure of a individual test case.

Will be called between testStarted and testEnded.

Parameters
test TestIdentifier: identifies the test

trace String: stack trace of failure

testIgnored

public abstract void testIgnored (TestIdentifier test)

Called when a test will not be run, generally because a test method is annotated with org.junit.Ignore.

Parameters
test TestIdentifier: identifies the test

testRunEnded

public abstract void testRunEnded (long elapsedTime, 
                 runMetrics)

Reports end of test run.

Parameters
elapsedTime long: device reported elapsed time, in milliseconds

runMetrics : a ERROR(/Map) of the metrics emitted during the execution of the test case by android.app.Instrumentation#addResults. The insertion order is preserved unless you emit a same key multiple times. Note that standard keys defined in IInstrumentationResultParser.StatusKeys are filtered out of this Map. Ddmlib may add extra test metrics defined in IInstrumentationResultParser.StatusKeys.

testRunFailed

public abstract void testRunFailed (String errorMessage)

Reports test run failed to complete due to a fatal error.

Parameters
errorMessage String: String describing reason for run failure.

testRunStarted

public abstract void testRunStarted (String runName, 
                int testCount)

Reports the start of a test run.

Parameters
runName String: the test run name

testCount int: total number of tests in test run

testRunStopped

public abstract void testRunStopped (long elapsedTime)

This method is deprecated.
This callback is never be invoked. To be deleted.

Reports test run stopped before completion due to a user request.

Parameters
elapsedTime long: device reported elapsed time, in milliseconds

testStarted

public abstract void testStarted (TestIdentifier test)

Reports the start of an individual test case.

Parameters
test TestIdentifier: identifies the test