public class

XmlResultReporter

extends CollectingTestListener
java.lang.Object
   ↳ com.android.tradefed.result.CollectingTestListener
     ↳ com.android.tradefed.result.XmlResultReporter

Class Overview

Writes JUnit results to an XML files in a format consistent with Ant's XMLJUnitResultFormatter.

Unlike Ant's formatter, this class does not report the execution time of tests.

Collects all test info in memory, then dumps to file when invocation is complete.

Ported from dalvik runner XmlReportPrinter.

Result files will be stored in path constructed via [--output-file-path]/[build_id]

Summary

Public Constructors
XmlResultReporter()
Public Methods
void invocationEnded(long elapsedTime)
Reports that the invocation has terminated, whether successfully or due to some error condition.
void invocationStarted(IBuildInfo buildInfo)
Reports the start of the test invocation.
void testFailed(ITestRunListener.TestFailure status, TestIdentifier test, String trace)
void testLog(String dataName, LogDataType dataType, InputStreamSource dataStream)
Provides the associated log or debug data from the test invocation.
[Expand]
Inherited Methods
From class com.android.tradefed.result.CollectingTestListener
From class java.lang.Object
From interface com.android.ddmlib.testrunner.ITestRunListener
From interface com.android.tradefed.result.ITestInvocationListener

Public Constructors

public XmlResultReporter ()

Public Methods

public void invocationEnded (long elapsedTime)

Reports that the invocation has terminated, whether successfully or due to some error condition.

Will be automatically called by the TradeFederation framework.

Parameters
elapsedTime the elapsed time of the invocation in ms

public void invocationStarted (IBuildInfo buildInfo)

Reports the start of the test invocation.

Will be automatically called by the TradeFederation framework.

Parameters
buildInfo information about the build being tested

public void testFailed (ITestRunListener.TestFailure status, TestIdentifier test, String trace)

public void testLog (String dataName, LogDataType dataType, InputStreamSource dataStream)

Provides the associated log or debug data from the test invocation.

Must be called before invocationFailed(Throwable) or invocationEnded(long)

The TradeFederation framework will automatically call this method, providing the host log and if applicable, the device logcat.

Parameters
dataName a String descriptive name of the data. e.g. "device_logcat". Note dataName may not be unique per invocation. ie implementers must be able to handle multiple calls with same dataName
dataType the LogDataType of the data
dataStream the InputStreamSource of the data. Implementers should call createInputStream to start reading the data, and ensure to close the resulting InputStream when complete. Callers should ensure the source of the data remains present and accessible until the testLog method completes.