ResultForwarder

public class ResultForwarder
extends Object implements ITestInvocationListener

java.lang.Object
   ↳ com.android.tradefed.result.ResultForwarder
Known Direct Subclasses
Known Indirect Subclasses
ShardMasterResultForwarder A ResultForwarder that combines the results of a sharded test invocations. 


A ITestInvocationListener that forwards invocation results to a list of other listeners.

Summary

Public constructors

ResultForwarder(List<ITestInvocationListener> listeners)

Create a ResultForwarder.

ResultForwarder(ITestInvocationListener... listeners)

Alternate variable arg constructor for ResultForwarder.

Protected constructors

ResultForwarder()

Create a ResultForwarder with deferred listener setting.

Public methods

TestSummary getSummary()

Allows the InvocationListener to return a summary.

void invocationEnded(long elapsedTime)

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

void invocationFailed(Throwable cause)

Reports an incomplete invocation due to some error condition.

void invocationStarted(IInvocationContext context)

Reports the start of the test invocation.

void testAssumptionFailure(TestIdentifier test, String trace)

void testEnded(TestIdentifier test, long endTime, Map<String, String> testMetrics)

void testEnded(TestIdentifier test, Map<String, String> testMetrics)

void testFailed(TestIdentifier test, String trace)

void testIgnored(TestIdentifier test)

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

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

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

void testRunFailed(String errorMessage)

void testRunStarted(String runName, int testCount)

void testRunStopped(long elapsedTime)

void testStarted(TestIdentifier test)

void testStarted(TestIdentifier test, long startTime)

Protected methods

List<ITestInvocationListener> getListeners()

Get the list of listeners.

void setListeners(ITestInvocationListener... listeners)

Set the listeners after construction.

void setListeners(List<ITestInvocationListener> listeners)

Set the listeners after construction.

Public constructors

ResultForwarder

ResultForwarder (List<ITestInvocationListener> listeners)

Create a ResultForwarder.

Parameters
listeners List: the real ITestInvocationListeners to forward results to

ResultForwarder

ResultForwarder (ITestInvocationListener... listeners)

Alternate variable arg constructor for ResultForwarder.

Parameters
listeners ITestInvocationListener: the real ITestInvocationListeners to forward results to

Protected constructors

ResultForwarder

ResultForwarder ()

Create a ResultForwarder with deferred listener setting. Intended only for use by subclasses.

Public methods

getSummary

TestSummary getSummary ()

Allows the InvocationListener to return a summary.

Returns
TestSummary A TestSummary summarizing the run, or null

invocationEnded

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 long: the elapsed time of the invocation in ms

invocationFailed

void invocationFailed (Throwable cause)

Reports an incomplete invocation due to some error condition.

Will be automatically called by the TradeFederation framework.

Parameters
cause Throwable: the Throwable cause of the failure

invocationStarted

void invocationStarted (IInvocationContext context)

Reports the start of the test invocation.

Will be automatically called by the TradeFederation framework. Reporters need to override this method to support multiple devices reporting.

Parameters
context IInvocationContext: information about the invocation

testAssumptionFailure

void testAssumptionFailure (TestIdentifier test, 
                String trace)

Parameters
test TestIdentifier
trace String

testEnded

void testEnded (TestIdentifier test, 
                long endTime, 
                Map<String, String> testMetrics)

Parameters
test TestIdentifier
endTime long
testMetrics Map

testEnded

void testEnded (TestIdentifier test, 
                Map<String, String> testMetrics)

Parameters
test TestIdentifier
testMetrics Map

testFailed

void testFailed (TestIdentifier test, 
                String trace)

Parameters
test TestIdentifier
trace String

testIgnored

void testIgnored (TestIdentifier test)

Parameters
test TestIdentifier

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.

testRunEnded

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

Parameters
elapsedTime long
runMetrics Map

testRunFailed

void testRunFailed (String errorMessage)

Parameters
errorMessage String

testRunStarted

void testRunStarted (String runName, 
                int testCount)

Parameters
runName String
testCount int

testRunStopped

void testRunStopped (long elapsedTime)

Parameters
elapsedTime long

testStarted

void testStarted (TestIdentifier test)

Parameters
test TestIdentifier

testStarted

void testStarted (TestIdentifier test, 
                long startTime)

Parameters
test TestIdentifier
startTime long

Protected methods

getListeners

List<ITestInvocationListener> getListeners ()

Get the list of listeners. Intended only for use by subclasses.

Returns
List<ITestInvocationListener> The list of ITestInvocationListeners.

setListeners

void setListeners (ITestInvocationListener... listeners)

Set the listeners after construction. Intended only for use by subclasses.

Parameters
listeners ITestInvocationListener: the real ITestInvocationListeners to forward results to

setListeners

void setListeners (List<ITestInvocationListener> listeners)

Set the listeners after construction. Intended only for use by subclasses.

Parameters
listeners List: the real ITestInvocationListeners to forward results to