TextResultReporter

public class TextResultReporter
extends InvocationToJUnitResultForwarder implements ITestInvocationListener, ILogSaverListener

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 setLogSaver(ILogSaver logSaver)

Set the ILogSaver to allow the implementor to save files.

void testAssumptionFailure(TestIdentifier testId, String trace)

void testEnded(TestIdentifier testId, Map<String, String> metrics)

Overrides parent to explicitly print out test metrics.

void testFailed(TestIdentifier 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, Map<String, String> metrics)

Overrides parent to explicitly print out metrics.

Public constructors

TextResultReporter

TextResultReporter ()

Creates a TextResultReporter.

Public methods

setLogSaver

void setLogSaver (ILogSaver logSaver)

Set the ILogSaver to allow the implementor to save files.

Parameters
logSaver ILogSaver: the ILogSaver

testAssumptionFailure

void testAssumptionFailure (TestIdentifier testId, 
                String trace)

Parameters
testId TestIdentifier
trace String

testEnded

void testEnded (TestIdentifier testId, 
                Map<String, String> metrics)

Overrides parent to explicitly print out test metrics.

Parameters
testId TestIdentifier
metrics Map

testFailed

void testFailed (TestIdentifier 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.

Parameters
testId TestIdentifier
trace String

testLog

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 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

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

Called when the test log is saved.

Should be used in place of 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

void testRunEnded (long elapsedTime, 
                Map<String, String> metrics)

Overrides parent to explicitly print out metrics.

Parameters
elapsedTime long
metrics Map