to top
public abstract class

NameMangleListener

extends Object
implements ITestInvocationListener
java.lang.Object
   ↳ com.android.tradefed.result.NameMangleListener

Class Overview

A proxy listener to translate test method, class, and package names as results are reported.

Summary

Public Constructors
NameMangleListener(ITestInvocationListener listener)
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(IBuildInfo buildInfo)
Reports the start of the test invocation.
void testAssumptionFailure(TestIdentifier test, String trace)
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)
Protected Methods
IBuildInfo mangleBuildInfo(IBuildInfo buildInfo)
This method is run on all IBuildInfos that are passed to the invocationStarted(IBuildInfo) callback.
TestIdentifier mangleTestId(TestIdentifier test)
String mangleTestRunName(String name)
This method is run on all test run names that are passed to the testRunStarted(String, int) callback.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.android.ddmlib.testrunner.ITestRunListener
From interface com.android.tradefed.result.ITestInvocationListener

Public Constructors

public NameMangleListener (ITestInvocationListener listener)

Public Methods

public TestSummary getSummary ()

Allows the InvocationListener to return a summary.

Returns

public 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 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 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 void testAssumptionFailure (TestIdentifier test, String trace)

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

public void testFailed (TestIdentifier test, String trace)

public void testIgnored (TestIdentifier test)

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

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

public void testRunFailed (String errorMessage)

public void testRunStarted (String runName, int testCount)

public void testRunStopped (long elapsedTime)

public void testStarted (TestIdentifier test)

Protected Methods

protected IBuildInfo mangleBuildInfo (IBuildInfo buildInfo)

This method is run on all IBuildInfos that are passed to the invocationStarted(IBuildInfo) callback. The method should return a possibly-different IBuildInfo that will be passed to the downstream ITestInvocationListener that was specified during construction.

The implementation should be careful to not modify the original IBuildInfo.

The default implementation passes the incoming IBuildInfo through unmodified.

protected TestIdentifier mangleTestId (TestIdentifier test)

This method is run on all TestIdentifiers that are passed to the testStarted(TestIdentifier), ERROR(/#testFailed(TestFailure, TestIdentifier, String)), and testEnded(TestIdentifier, Map) callbacks. The method should return a possibly-different TestIdentifier that will be passed to the downstream ITestInvocationListener that was specified during construction.

The implementation should be careful to not modify the original TestIdentifier.

The default implementation passes the incoming identifier through unmodified.

protected String mangleTestRunName (String name)

This method is run on all test run names that are passed to the testRunStarted(String, int) callback. The method should return a possibly-different test run name that will be passed to the downstream ITestInvocationListener that was specified during construction.

The implementation should be careful to not modify the original run name.

The default implementation passes the incoming test run name through unmodified.