public class TestRunResult extends java.lang.Object implements ITestRunListener
Maintains an accurate count of tests, and tracks incomplete tests.
Not thread safe! The test* callbacks must be called in order
| Constructor and Description |
|---|
TestRunResult()
Create an empty
TestRunResult. |
| Modifier and Type | Method and Description |
|---|---|
java.util.Set<TestIdentifier> |
getCompletedTests()
Gets the set of completed tests.
|
long |
getElapsedTime()
Returns the current run elapsed time.
|
java.lang.String |
getName() |
int |
getNumAllFailedTests()
Return total number of tests in a failure state (failed, assumption failure)
|
int |
getNumCompleteTests()
Gets the number of complete tests in this run ie with status != incomplete.
|
int |
getNumTests()
Gets the number of tests in this run.
|
int |
getNumTestsInState(TestResult.TestStatus status)
Gets the number of tests in given state for this run.
|
java.lang.String |
getRunFailureMessage()
Return the run failure error message,
null if run did not fail. |
java.util.Map<java.lang.String,java.lang.String> |
getRunMetrics() |
java.util.Map<TestIdentifier,TestResult> |
getTestResults()
Returns a map of the test results.
|
java.lang.String |
getTextSummary()
Returns a user friendly string describing results.
|
boolean |
hasFailedTests() |
boolean |
isRunComplete() |
boolean |
isRunFailure() |
void |
setAggregateMetrics(boolean metricAggregation) |
void |
setRunComplete(boolean runComplete) |
void |
testAssumptionFailure(TestIdentifier test,
java.lang.String trace)
Called when an atomic test flags that it assumes a condition that is
false
|
void |
testEnded(TestIdentifier test,
long endTime,
java.util.Map<java.lang.String,java.lang.String> testMetrics)
Alternative to
ITestRunListener.testEnded(TestIdentifier, Map) where we can specify the end time
directly. |
void |
testEnded(TestIdentifier test,
java.util.Map<java.lang.String,java.lang.String> testMetrics)
Reports the execution end of an individual test case.
|
void |
testFailed(TestIdentifier test,
java.lang.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,
java.util.Map<java.lang.String,java.lang.String> runMetrics)
Reports end of test run.
|
void |
testRunFailed(java.lang.String errorMessage)
Reports test run failed to complete due to a fatal error.
|
void |
testRunStarted(java.lang.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.
|
void |
testStarted(TestIdentifier test,
long startTime)
Alternative to
ITestRunListener.testStarted(TestIdentifier) where we also specify when the test was
started, combined with ITestRunListener.testEnded(TestIdentifier, long, Map) for accurate measure. |
public TestRunResult()
TestRunResult.public void setAggregateMetrics(boolean metricAggregation)
public java.lang.String getName()
public java.util.Map<TestIdentifier,TestResult> getTestResults()
public java.util.Map<java.lang.String,java.lang.String> getRunMetrics()
Map of the test test run metrics.public java.util.Set<TestIdentifier> getCompletedTests()
public boolean isRunFailure()
true if test run failed.public boolean isRunComplete()
true if test run finished.public void setRunComplete(boolean runComplete)
public int getNumTestsInState(TestResult.TestStatus status)
public int getNumTests()
public int getNumCompleteTests()
public boolean hasFailedTests()
true if test run had any failed or error tests.public int getNumAllFailedTests()
public long getElapsedTime()
public java.lang.String getRunFailureMessage()
null if run did not fail.public void testRunStarted(java.lang.String runName,
int testCount)
ITestRunListenertestRunStarted in interface ITestRunListenerrunName - the test run nametestCount - total number of tests in test runpublic void testStarted(TestIdentifier test)
ITestRunListenertestStarted in interface ITestRunListenertest - identifies the testpublic void testStarted(TestIdentifier test, long startTime)
ITestRunListenerITestRunListener.testStarted(TestIdentifier) where we also specify when the test was
started, combined with ITestRunListener.testEnded(TestIdentifier, long, Map) for accurate measure.testStarted in interface ITestRunListenertest - identifies the teststartTime - the time the test started, measured via System.currentTimeMillis()public void testFailed(TestIdentifier test, java.lang.String trace)
ITestRunListenerWill be called between testStarted and testEnded.
testFailed in interface ITestRunListenertest - identifies the testtrace - stack trace of failurepublic void testAssumptionFailure(TestIdentifier test, java.lang.String trace)
ITestRunListenertestAssumptionFailure in interface ITestRunListenertest - identifies the testtrace - stack trace of failurepublic void testIgnored(TestIdentifier test)
ITestRunListenertestIgnored in interface ITestRunListenertest - identifies the testpublic void testEnded(TestIdentifier test, java.util.Map<java.lang.String,java.lang.String> testMetrics)
ITestRunListener
If ITestRunListener.testFailed(com.android.ddmlib.testrunner.TestIdentifier, java.lang.String) was not invoked, this test passed. Also returns any key/value
metrics which may have been emitted during the test case's execution.
testEnded in interface ITestRunListenertest - identifies the testtestMetrics - a Map of the metrics emittedpublic void testEnded(TestIdentifier test, long endTime, java.util.Map<java.lang.String,java.lang.String> testMetrics)
ITestRunListenerITestRunListener.testEnded(TestIdentifier, Map) where we can specify the end time
directly. Combine with ITestRunListener.testStarted(TestIdentifier, long) for accurate measure.testEnded in interface ITestRunListenertest - identifies the testendTime - the time the test ended, measured via System.currentTimeMillis()testMetrics - a Map of the metrics emittedpublic void testRunFailed(java.lang.String errorMessage)
ITestRunListenertestRunFailed in interface ITestRunListenererrorMessage - String describing reason for run failure.public void testRunStopped(long elapsedTime)
ITestRunListenerTODO: currently unused, consider removing
testRunStopped in interface ITestRunListenerelapsedTime - device reported elapsed time, in millisecondspublic void testRunEnded(long elapsedTime,
java.util.Map<java.lang.String,java.lang.String> runMetrics)
ITestRunListenertestRunEnded in interface ITestRunListenerelapsedTime - device reported elapsed time, in millisecondsrunMetrics - key-value pairs reported at the end of a test runpublic java.lang.String getTextSummary()