public interface

ITestInvocationListener

implements ITestRunListener
com.android.tradefed.result.ITestInvocationListener
Known Indirect Subclasses

Class Overview

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>/li>
  • 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
abstract TestSummary getSummary()
Allows the InvocationListener to return a summary.
abstract void invocationEnded(long elapsedTime)
Reports that the invocation has terminated, whether successfully or due to some error condition.
abstract void invocationFailed(Throwable cause)
Reports an incomplete invocation due to some error condition.
abstract void invocationStarted(IBuildInfo buildInfo)
Reports the start of the test invocation.
abstract void testLog(String dataName, LogDataType dataType, InputStreamSource dataStream)
Provides the associated log or debug data from the test invocation.
[Expand]
Inherited Methods
From interface com.android.ddmlib.testrunner.ITestRunListener

Public Methods

public abstract TestSummary getSummary ()

Allows the InvocationListener to return a summary.

Returns

public abstract 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 the elapsed time of the invocation in ms

public abstract void invocationFailed (Throwable cause)

Reports an incomplete invocation due to some error condition.

Will be automatically called by the TradeFederation framework.

Parameters
cause the Throwable cause of the failure

public abstract void invocationStarted (IBuildInfo buildInfo)

Reports the start of the test invocation.

Will be automatically called by the TradeFederation framework.

Parameters
buildInfo information about the build being tested

public abstract 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 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 the LogDataType of the data
dataStream 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.