TextResultReporter

public class TextResultReporter
extends InvocationToJUnitResultForwarder implements ILogSaverListener, ITestInvocationListener

java.lang.Object
   ↳ com.android.tradefed.result.InvocationToJUnitResultForwarder
     ↳ com.android.tradefed.result.TextResultReporter


A test result reporter that forwards results to the JUnit text result printer.

Summary

Public constructors

TextResultReporter()

Creates a TextResultReporter.

Public methods

void testAssumptionFailure(TestDescription testId, String trace)

Called when an atomic test flags that it assumes a condition that is false

void testEnded(TestDescription testId, metrics)

Overrides parent to explicitly print out test metrics.

void testFailed(TestDescription testId, String trace)

Overrides parent to explicitly print out failures.

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

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

void testLogSaved(String dataName, LogDataType dataType, InputStreamSource dataStream, LogFile logFile)

Called when the test log is saved.

void testRunEnded(long elapsedTime, metrics)

Overrides parent to explicitly print out metrics.

Public constructors

TextResultReporter

public TextResultReporter ()

Creates a TextResultReporter.

Public methods

testAssumptionFailure

public void testAssumptionFailure (TestDescription testId, 
                String trace)

Called when an atomic test flags that it assumes a condition that is false

Parameters
testId TestDescription: identifies the test

trace String: stack trace of failure

testEnded

public void testEnded (TestDescription testId, 
                 metrics)

Overrides parent to explicitly print out test metrics.

Parameters
testId TestDescription: identifies the test

metrics : a ERROR(/Map) of the metrics emitted

testFailed

public void testFailed (TestDescription testId, 
                String trace)

Overrides parent to explicitly print out failures. The ResultPrinter relies on the runner calling "print" at end of test run to do this. Reports the failure of a individual test case.

Will be called between testStarted and testEnded.

Parameters
testId TestDescription: identifies the test

trace String: stack trace of failure

testLog

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

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

Must be called before ERROR(/ITestInvocationListener#invocationFailed(Throwable)) or ERROR(/ITestInvocationListener#invocationEnded(long))

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

Parameters
dataName String: 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 LogDataType: the LogDataType of the data

dataStream InputStreamSource: 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.

testLogSaved

public void testLogSaved (String dataName, 
                LogDataType dataType, 
                InputStreamSource dataStream, 
                LogFile logFile)

Called when the test log is saved.

Should be used in place of ITestInvocationListener#testLog(String, LogDataType, InputStreamSource).

Parameters
dataName String: 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 LogDataType: the LogDataType of the data

dataStream InputStreamSource: the InputStreamSource of the data. Implementers should call createInputStream to start reading the data, and ensure to close the resulting InputStream when complete.

logFile LogFile: the LogFile containing the meta data of the saved file.

testRunEnded

public void testRunEnded (long elapsedTime, 
                 metrics)

Overrides parent to explicitly print out metrics.

Parameters
elapsedTime long: device reported elapsed time, in milliseconds

metrics : key-value pairs reported at the end of a test run