ITestInvocationListener

public interface ITestInvocationListener
implements ITestRunListener, ITestLogger

com.android.tradefed.result.ITestInvocationListener
Known Indirect Subclasses
AggregatingProfilerListener An ITestInvocationListener which communicates test progress to instances of ITestProfiler
BugreportCollector A pass-through ITestInvocationListener that collects bugreports when configurable events occur and then calls testLog(String, LogDataType, InputStreamSource) on its children after each bugreport is collected. 
CodeCoverageReporter A ITestInvocationListener that will generate code coverage reports. 
CodeCoverageTestBase.CoverageCollectingListener A ResultForwarder which collects coverage files. 
CollectingTestListener A ITestInvocationListener that will collect all test results. 
ConsoleResultReporter Result reporter to print the test results to the console. 
DeviceUnavailEmailResultReporter An EmailResultReporter that will send email when invocation fails due to a device not available exception. 
EmailResultReporter A simple result reporter base class that sends emails for test results. 
ExecCommandTracker  
FailureEmailResultReporter An EmailResultReporter that sends notifications if either a test failure or invocation failure occurred. 
FileMetadataCollector A listener that collects and uploads metadata about saved log files. 
ICommandScheduler.IScheduledInvocationListener Listener for invocation events when invocation completes. 
ILogSaverListener Allows for ITestInvocationListeners to listen for when log files are saved. 
IShardableListener A ITestInvocationListener that can be sharded. 
ITestSummaryListener  
InvocationFailureEmailResultReporter An EmailResultReporter that can also restrict notifications to just invocation failures. 
InvocationToJUnitResultForwarder A class that listens to ITestInvocationListener events and forwards them to a TestListener
JsonHttpTestResultReporter A result reporter that encode test metrics results and branch, device info into JSON and POST into an HTTP service endpoint  
LogSaverResultForwarder A ResultForwarder for saving logs with the global file saver. 
ModuleListener Listener attached to each IRemoteTest of each module in order to collect the list of results. 
NameMangleListener A proxy listener to translate test method, class, and package names as results are reported. 
ResultForwarder A ITestInvocationListener that forwards invocation results to a list of other listeners. 
ShardListener A ITestInvocationListener that collects results from a invocation shard (aka an invocation split to run on multiple resources in parallel), and forwards them to another listener. 
ShardMasterResultForwarder A ResultForwarder that combines the results of a sharded test invocations. 
StubTestInvocationListener This class is deprecated. Classes should implement ITestInvocationListener directly.  
SubprocessResultsReporter Implements ITestInvocationListener to be specified as a result_reporter and forward from the subprocess the results of tests, test runs, test invocations. 
SuiteResultReporter Collect test results for an entire suite invocation and output the final results. 
TestFailureEmailResultReporter An EmailResultReporter that can also restrict notifications to just test failures. 
TestFailureListener Listener used to take action such as screenshot, bugreport, logcat collection upon a test failure when requested. 
TextResultReporter A test result reporter that forwards results to the JUnit text result printer. 
XmlResultReporter Writes JUnit results to an XML files in a format consistent with Ant's XMLJUnitResultFormatter. 


Listener for test results from the test invocation.

A test invocation can itself include multiple test runs, so the sequence of calls will be

  • invocationStarted(BuildInfo)
  • testRunStarted
  • testStarted
  • [testFailed]
  • testEnded
  • ...
  • testRunEnded
  • ...
  • testRunStarted
  • ...
  • testRunEnded
  • [invocationFailed]
  • [testLog+]
  • invocationEnded
  • getSummary

Note that this is re-using the ITestRunListener because it's a generic interface. The results being reported are not necessarily device specific.

Summary

Public methods

default TestSummary getSummary()

Allows the InvocationListener to return a summary.

default void invocationEnded(long elapsedTime)

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

default void invocationFailed(Throwable cause)

Reports an incomplete invocation due to some error condition.

default void invocationInterrupted()

Called on shutdown(), gives the invocation the opportunity to do something before terminating.

default void invocationStarted(IInvocationContext context)

Reports the start of the test invocation.

default void testAssumptionFailure(TestIdentifier test, String trace)

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

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

default void testFailed(TestIdentifier test, String trace)

default void testIgnored(TestIdentifier test)

default void testRunEnded(long elapsedTimeMillis, Map<String, String> runMetrics)

default void testRunFailed(String errorMessage)

default void testRunStarted(String runName, int testCount)

default void testRunStopped(long elapsedTime)

default void testStarted(TestIdentifier test)

default void testStarted(TestIdentifier test, long startTime)

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

invocationInterrupted

void invocationInterrupted ()

Called on shutdown(), gives the invocation the opportunity to do something before terminating.

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

testRunEnded

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

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