ITestRunListener


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 functions

Unit

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

Unit
testEnded(
    test: TestIdentifier!,
    testMetrics: (Mutable)Map<String!, String!>!
)

Reports the execution end of an individual test case.

Unit
testFailed(test: TestIdentifier!, trace: String!)

Reports the failure of a individual test case.

Unit

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

Unit
testRunEnded(elapsedTime: Long, runMetrics: (Mutable)Map<String!, String!>!)

Reports end of test run.

Unit
testRunFailed(errorMessage: String!)

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

Unit
testRunStarted(runName: String!, testCount: Int)

Reports the start of a test run.

Unit
testRunStopped(elapsedTime: Long)

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

Unit

Reports the start of an individual test case.

Public functions

testAssumptionFailure

fun testAssumptionFailure(test: TestIdentifier!, trace: String!): Unit

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

fun testEnded(
    test: TestIdentifier!,
    testMetrics: (Mutable)Map<String!, String!>!
): Unit

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

identifies the test

testMetrics: (Mutable)Map<String!, String!>!

a Map of the metrics emitted

testFailed

fun testFailed(test: TestIdentifier!, trace: String!): Unit

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

fun testIgnored(test: TestIdentifier!): Unit

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

fun testRunEnded(elapsedTime: Long, runMetrics: (Mutable)Map<String!, String!>!): Unit

Reports end of test run.

Parameters
elapsedTime: Long

device reported elapsed time, in milliseconds

runMetrics: (Mutable)Map<String!, String!>!

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

testRunFailed

fun testRunFailed(errorMessage: String!): Unit

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

Parameters
errorMessage: String!

String describing reason for run failure.

testRunStarted

fun testRunStarted(runName: String!, testCount: Int): Unit

Reports the start of a test run.

Parameters
runName: String!

the test run name

testCount: Int

total number of tests in test run

testRunStopped

fun testRunStopped(elapsedTime: Long): Unit

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

TODO: currently unused, consider removing

Parameters
elapsedTime: Long

device reported elapsed time, in milliseconds

testStarted

fun testStarted(test: TestIdentifier!): Unit

Reports the start of an individual test case.

Parameters
test: TestIdentifier!

identifies the test