public class XmlTestRunListener extends java.lang.Object implements ITestRunListener
Creates a separate XML file per test run.
| Constructor and Description |
|---|
XmlTestRunListener() |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
getPropertiesAttributes()
Get the properties attributes as key value pairs to be included in the test report.
|
protected java.io.File |
getResultFile(java.io.File reportDir)
Creates a
File where the report will be created. |
TestRunResult |
getRunResult()
Returns the
TestRunResult |
protected java.lang.String |
getTestName(TestIdentifier testId) |
protected java.lang.String |
getTestSuiteName() |
void |
setHostName(java.lang.String hostName) |
void |
setReportDir(java.io.File file)
Sets the report file to use.
|
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,
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 numTests)
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 void setReportDir(java.io.File file)
public void setHostName(java.lang.String hostName)
public TestRunResult getRunResult()
TestRunResultpublic void testRunStarted(java.lang.String runName,
int numTests)
ITestRunListenertestRunStarted in interface ITestRunListenerrunName - the test run namenumTests - total number of tests in test runpublic void testStarted(TestIdentifier test)
ITestRunListenertestStarted in interface ITestRunListenertest - identifies the testpublic 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 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 runprotected java.io.File getResultFile(java.io.File reportDir)
throws java.io.IOException
File where the report will be created.reportDir - the root directory of the report.java.io.IOExceptionprotected java.lang.String getTestSuiteName()
@NonNull protected java.util.Map<java.lang.String,java.lang.String> getPropertiesAttributes()
protected java.lang.String getTestName(TestIdentifier testId)