{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}
public class TestRunResult implements 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 methods |
|
|---|---|
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 |
Gets the number of tests in given state for this run. |
String |
Return the run failure error message, |
Map<String, String> |
|
Map<TestIdentifier, TestResult> |
Gets a map of the test results. |
String |
Return a user friendly string describing results. |
boolean |
|
boolean |
|
boolean |
|
void |
setAggregateMetrics(boolean metricAggregation) |
void |
setRunComplete(boolean runComplete) |
void |
testAssumptionFailure(TestIdentifier test, String trace)Called when an atomic test flags that it assumes a condition that is false |
void |
testEnded(TestIdentifier test, Map<String, String> testMetrics)Reports the execution end of an individual test case. |
void |
testFailed(TestIdentifier test, String trace)Reports the failure of a individual test case. |
void |
testIgnored(TestIdentifier test)Called when a test will not be run, generally because a test method is annotated with org.junit.Ignore. |
void |
testRunEnded(long elapsedTime, Map<String, String> runMetrics)Reports end of test run. |
void |
testRunFailed(String errorMessage)Reports test run failed to complete due to a fatal error. |
void |
testRunStarted(String runName, int testCount)Reports the start of a test run. |
void |
testRunStopped(long elapsedTime)Reports test run stopped before completion due to a user request. |
void |
testStarted(TestIdentifier test)Reports the start of an individual test case. |
public TestRunResult()
Create an emptyandroidx.test.orchestrator.listeners.result.TestRunResult.
public int getNumAllFailedTests()
Return total number of tests in a failure state (failed, assumption failure)
public int getNumCompleteTests()
Gets the number of complete tests in this run ie with status != incomplete.
public int getNumTestsInState(TestResult.TestStatus status)
Gets the number of tests in given state for this run.
public String getRunFailureMessage()
Return the run failure error message, null if run did not fail.
public Map<TestIdentifier, TestResult> getTestResults()
Gets a map of the test results.
| Returns | |
|---|---|
Map<TestIdentifier, TestResult> |
|
public String getTextSummary()
Return a user friendly string describing results.
| Returns | |
|---|---|
String |
|
public boolean hasFailedTests()
| Returns | |
|---|---|
boolean |
|
public 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 |
public void testEnded(TestIdentifier test, Map<String, 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.
| Parameters | |
|---|---|
TestIdentifier test |
identifies the test |
Map<String, String> testMetrics |
a |
public 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 |
public 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 |
public void testRunEnded(long elapsedTime, Map<String, String> runMetrics)
Reports end of test run.
public void testRunFailed(String errorMessage)
Reports test run failed to complete due to a fatal error.
public 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 |
public 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 |
public void testStarted(TestIdentifier test)
Reports the start of an individual test case.
| Parameters | |
|---|---|
TestIdentifier test |
identifies the test |