SubprocessResultsReporter

public class SubprocessResultsReporter
extends Object implements ITestInvocationListener, AutoCloseable

java.lang.Object
   ↳ com.android.tradefed.result.SubprocessResultsReporter


Implements ITestInvocationListener to be specified as a result_reporter and forward from the subprocess the results of tests, test runs, test invocations.

Summary

Public constructors

SubprocessResultsReporter()

Public methods

void close()

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 printEvent(String key, Object event)

Helper to print the event key and then the json object.

void testAssumptionFailure(TestIdentifier testId, String trace)

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

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

void testFailed(TestIdentifier testId, String reason)

void testIgnored(TestIdentifier testId)

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

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

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

void testRunFailed(String reason)

void testRunStarted(String runName, int testCount)

void testRunStopped(long arg0)

void testStarted(TestIdentifier testId)

void testStarted(TestIdentifier testId, long startTime)

Public constructors

SubprocessResultsReporter

SubprocessResultsReporter ()

Public methods

close

void close ()

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

printEvent

void printEvent (String key, 
                Object event)

Helper to print the event key and then the json object.

Parameters
key String

event Object

testAssumptionFailure

void testAssumptionFailure (TestIdentifier testId, 
                String trace)

Parameters
testId TestIdentifier

trace String

testEnded

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

Parameters
testId TestIdentifier

endTime long

metrics Map

testEnded

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

Parameters
testId TestIdentifier

metrics Map

testFailed

void testFailed (TestIdentifier testId, 
                String reason)

Parameters
testId TestIdentifier

reason String

testIgnored

void testIgnored (TestIdentifier testId)

Parameters
testId 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 time, 
                Map<String, String> runMetrics)

Parameters
time long

runMetrics Map

testRunFailed

void testRunFailed (String reason)

Parameters
reason String

testRunStarted

void testRunStarted (String runName, 
                int testCount)

Parameters
runName String

testCount int

testRunStopped

void testRunStopped (long arg0)

Parameters
arg0 long

testStarted

void testStarted (TestIdentifier testId)

Parameters
testId TestIdentifier

testStarted

void testStarted (TestIdentifier testId, 
                long startTime)

Parameters
testId TestIdentifier

startTime long