ITestRunListener


public interface ITestRunListener

Known direct subclasses
TestRunResult

Holds results from a single test run.


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

This is a copy of com.android.ddmlib.testrunner.ITestRunListener.

Summary

Public methods

abstract void

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

abstract void
testEnded(TestIdentifier test, Map<StringString> testMetrics)

Reports the execution end of an individual test case.

abstract void

Reports the failure of a individual test case.

abstract void

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

abstract void
testRunEnded(long elapsedTime, Map<StringString> 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)

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

abstract void

Reports the start of an individual test case.

Public methods

testAssumptionFailure

abstract void testAssumptionFailure(TestIdentifier test, String trace)

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

Parameters
TestIdentifier test

identifies the test

String trace

stack trace of failure

testEnded

abstract void testEnded(TestIdentifier test, Map<StringString> testMetrics)

Reports the execution end of an individual test case.

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

Parameters
TestIdentifier test

identifies the test

Map<StringString> testMetrics

a Map of the metrics emitted

testFailed

abstract void testFailed(TestIdentifier test, String trace)

Reports the failure of a individual test case.

Will be called between testStarted and testEnded.

Parameters
TestIdentifier test

identifies the test

String trace

stack trace of failure

testIgnored

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
TestIdentifier test

identifies the test

testRunEnded

abstract void testRunEnded(long elapsedTime, Map<StringString> runMetrics)

Reports end of test run.

Parameters
long elapsedTime

device reported elapsed time, in milliseconds

Map<StringString> runMetrics

key-value pairs reported at the end of a test run

testRunFailed

abstract void testRunFailed(String errorMessage)

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

Parameters
String errorMessage

String describing reason for run failure.

testRunStarted

abstract void testRunStarted(String runName, int testCount)

Reports the start of a test run.

Parameters
String runName

the test run name

int testCount

total number of tests in test run

testRunStopped

abstract void testRunStopped(long elapsedTime)

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

TODO: currently unused, consider removing

Parameters
long elapsedTime

device reported elapsed time, in milliseconds

testStarted

abstract void testStarted(TestIdentifier test)

Reports the start of an individual test case.

Parameters
TestIdentifier test

identifies the test