{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}
interface ITestRunListener
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:
This is a copy of com.android.ddmlib.testrunner.ITestRunListener.
Public methods |
|
|---|---|
abstract @NonNull void |
testAssumptionFailure(@NonNull TestIdentifier test, @NonNull String trace)Called when an atomic test flags that it assumes a condition that is false |
abstract @NonNull void |
testEnded(Reports the execution end of an individual test case. |
abstract @NonNull void |
testFailed(@NonNull TestIdentifier test, @NonNull String trace)Reports the failure of a individual test case. |
abstract @NonNull void |
testIgnored(@NonNull TestIdentifier test)Called when a test will not be run, generally because a test method is annotated with org.junit.Ignore. |
abstract @NonNull void |
Reports end of test run. |
abstract @NonNull void |
testRunFailed(@NonNull String errorMessage)Reports test run failed to complete due to a fatal error. |
abstract @NonNull void |
testRunStarted(@NonNull String runName, @NonNull int testCount)Reports the start of a test run. |
abstract @NonNull void |
testRunStopped(@NonNull long elapsedTime)Reports test run stopped before completion due to a user request. |
abstract @NonNull void |
testStarted(@NonNull TestIdentifier test)Reports the start of an individual test case. |
@NonNull
public abstract void testAssumptionFailure(@NonNull TestIdentifier test, @NonNull String trace)
Called when an atomic test flags that it assumes a condition that is false
| Parameters | |
|---|---|
@NonNull TestIdentifier test |
identifies the test |
@NonNull String trace |
stack trace of failure |
@NonNull
public abstract void testEnded(
@NonNull TestIdentifier test,
@NonNull Map<@NonNull String, @NonNull String> 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.
@NonNull
public abstract void testFailed(@NonNull TestIdentifier test, @NonNull String trace)
Reports the failure of a individual test case.
Will be called between testStarted and testEnded.
| Parameters | |
|---|---|
@NonNull TestIdentifier test |
identifies the test |
@NonNull String trace |
stack trace of failure |
@NonNull
public abstract void testIgnored(@NonNull TestIdentifier test)
Called when a test will not be run, generally because a test method is annotated with org.junit.Ignore.
| Parameters | |
|---|---|
@NonNull TestIdentifier test |
identifies the test |
@NonNull
public abstract void testRunEnded(
@NonNull long elapsedTime,
@NonNull Map<@NonNull String, @NonNull String> runMetrics
)
Reports end of test run.
@NonNull
public abstract void testRunFailed(@NonNull String errorMessage)
Reports test run failed to complete due to a fatal error.
@NonNull
public abstract void testRunStarted(@NonNull String runName, @NonNull int testCount)
Reports the start of a test run.
@NonNull
public abstract void testRunStopped(@NonNull long elapsedTime)
Reports test run stopped before completion due to a user request.
TODO: currently unused, consider removing
| Parameters | |
|---|---|
@NonNull long elapsedTime |
device reported elapsed time, in milliseconds |
@NonNull
public abstract void testStarted(@NonNull TestIdentifier test)
Reports the start of an individual test case.
| Parameters | |
|---|---|
@NonNull TestIdentifier test |
identifies the test |