TestResultListener
public
abstract
class
TestResultListener
extends Object
implements
ITestLifeCycleReceiver
| java.lang.Object | |
| ↳ | com.android.tradefed.result.TestResultListener |
A simplification of ITestLifecycleListener for implementers that only care about individual test results.
It filters the various lifecycle events down to a testResult method.
It is NOT thread safe - and in particular assumes that the ITestLifecycleListener events are received in order.
Summary
Public constructors | |
|---|---|
TestResultListener()
|
|
Public methods | |
|---|---|
final
void
|
testAssumptionFailure(TestDescription test, String trace)
Called when an atomic test flags that it assumes a condition that is false |
final
void
|
testEnded(TestDescription test,
Reports the execution end of an individual test case. |
final
void
|
testEnded(TestDescription test, long endTime,
Alternative to |
final
void
|
testFailed(TestDescription test, String trace)
Reports the failure of a individual test case. |
final
void
|
testIgnored(TestDescription test)
Called when a test will not be run, generally because a test method is annotated with org.junit.Ignore. |
abstract
void
|
testResult(TestDescription test, TestResult result)
|
void
|
testRunEnded(long elapsedTimeMillis,
Reports end of test run. |
void
|
testSkipped(TestDescription test, SkipReason reason)
Called when a test is skipped and did not execute for a reason that is not usually expected. |
final
void
|
testStarted(TestDescription test, long startTime)
Alternative to |
final
void
|
testStarted(TestDescription test)
Reports the start of an individual test case. |
Public constructors
TestResultListener
public TestResultListener ()
Public methods
testAssumptionFailure
public final void testAssumptionFailure (TestDescription test, String trace)
Called when an atomic test flags that it assumes a condition that is false
| Parameters | |
|---|---|
test |
TestDescription: identifies the test |
trace |
String: stack trace of failure |
testEnded
public final void testEnded (TestDescription test,testMetrics)
Reports the execution end of an individual test case.
If testFailed(TestDescription, FailureDescription) 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 |
TestDescription: identifies the test |
testMetrics |
: a ERROR(/Map) of the metrics emitted |
testEnded
public final void testEnded (TestDescription test, long endTime,testMetrics)
Alternative to ERROR(/#testEnded(com.android.tradefed.result.TestDescription,Map)) where we can specify the end time
directly. Combine with testStarted(com.android.tradefed.result.TestDescription, long) for accurate measure.
| Parameters | |
|---|---|
test |
TestDescription: identifies the test |
endTime |
long: the time the test ended, measured via System.currentTimeMillis() |
testMetrics |
: a ERROR(/Map) of the metrics emitted |
testFailed
public final void testFailed (TestDescription test, String trace)
Reports the failure of a individual test case.
Will be called between testStarted and testEnded.
| Parameters | |
|---|---|
test |
TestDescription: identifies the test |
trace |
String: stack trace of failure |
testIgnored
public final void testIgnored (TestDescription test)
Called when a test will not be run, generally because a test method is annotated with org.junit.Ignore.
| Parameters | |
|---|---|
test |
TestDescription: identifies the test |
testResult
public abstract void testResult (TestDescription test, TestResult result)
| Parameters | |
|---|---|
test |
TestDescription |
result |
TestResult |
testRunEnded
public void testRunEnded (long elapsedTimeMillis,
runMetrics) Reports end of test run.
| Parameters | |
|---|---|
elapsedTimeMillis |
long: device reported elapsed time, in milliseconds |
runMetrics |
: key-value pairs reported at the end of a test run |
testSkipped
public void testSkipped (TestDescription test, SkipReason reason)
Called when a test is skipped and did not execute for a reason that is not usually expected. These tests will be attempted to be retried to attempt to get a proper execution.
| Parameters | |
|---|---|
test |
TestDescription: identifies the test |
reason |
SkipReason: SkipReason |
testStarted
public final void testStarted (TestDescription test, long startTime)
Alternative to testStarted(com.android.tradefed.result.TestDescription) where we also specify when the test was
started, combined with ERROR(/#testEnded(com.android.tradefed.result.TestDescription,long,Map)) for accurate measure.
| Parameters | |
|---|---|
test |
TestDescription: identifies the test |
startTime |
long: the time the test started, measured via System.currentTimeMillis() |
testStarted
public final void testStarted (TestDescription test)
Reports the start of an individual test case. Older interface, should use testStarted(com.android.tradefed.result.TestDescription) whenever possible.
| Parameters | |
|---|---|
test |
TestDescription: identifies the test |