{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}
class TestRunResult : ITestRunListener
Holds results from a single test run.
Maintains an accurate count of tests, and tracks incomplete tests.
Not thread safe! The test* callbacks must be called in order
This is an android-compatible copy of com.android.ddmlib.testrunner.TestRunResult.
Public constructors |
|
|---|---|
|
Create an empty |
|
Public functions |
|
|---|---|
(Mutable)Set<TestIdentifier!>! |
Gets the set of completed tests. |
Long |
|
String! |
getName() |
Int |
Return total number of tests in a failure state (failed, assumption failure) |
Int |
Gets the number of complete tests in this run ie with status != incomplete. |
Int |
Gets the number of tests in this run. |
Int |
getNumTestsInState(status: TestResult.TestStatus!)Gets the number of tests in given state for this run. |
String! |
Return the run failure error message, |
(Mutable)Map<String!, String!>! |
|
(Mutable)Map<TestIdentifier!, TestResult!>! |
Gets a map of the test results. |
String! |
Return a user friendly string describing results. |
Boolean |
|
Boolean |
|
Boolean |
|
Unit |
setAggregateMetrics(metricAggregation: Boolean) |
Unit |
setRunComplete(runComplete: Boolean) |
Unit |
testAssumptionFailure(test: TestIdentifier!, trace: String!)Called when an atomic test flags that it assumes a condition that is false |
Unit |
Reports the execution end of an individual test case. |
Unit |
testFailed(test: TestIdentifier!, trace: String!)Reports the failure of a individual test case. |
Unit |
testIgnored(test: TestIdentifier!)Called when a test will not be run, generally because a test method is annotated with org.junit.Ignore. |
Unit |
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 |
testStarted(test: TestIdentifier!)Reports the start of an individual test case. |
TestRunResult()
Create an emptyandroidx.test.orchestrator.listeners.result.TestRunResult.
fun getCompletedTests(): (Mutable)Set<TestIdentifier!>!
Gets the set of completed tests.
fun getNumAllFailedTests(): Int
Return total number of tests in a failure state (failed, assumption failure)
fun getNumCompleteTests(): Int
Gets the number of complete tests in this run ie with status != incomplete.
fun getNumTestsInState(status: TestResult.TestStatus!): Int
Gets the number of tests in given state for this run.
fun getRunFailureMessage(): String!
Return the run failure error message, null if run did not fail.
fun getTestResults(): (Mutable)Map<TestIdentifier!, TestResult!>!
Gets a map of the test results.
| Returns | |
|---|---|
(Mutable)Map<TestIdentifier!, TestResult!>! |
|
fun getTextSummary(): String!
Return a user friendly string describing results.
| Returns | |
|---|---|
String! |
|
fun hasFailedTests(): Boolean
| Returns | |
|---|---|
Boolean |
|
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 |
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.
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 |
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 |
fun testRunEnded(elapsedTime: Long, runMetrics: (Mutable)Map<String!, String!>!): Unit
Reports end of test run.
fun testRunFailed(errorMessage: String!): Unit
Reports test run failed to complete due to a fatal error.
fun testRunStarted(runName: String!, testCount: Int): Unit
Reports the start of a test run.
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 |
fun testStarted(test: TestIdentifier!): Unit
Reports the start of an individual test case.
| Parameters | |
|---|---|
test: TestIdentifier! |
identifies the test |