JUnitToInvocationResultForwarder

public class JUnitToInvocationResultForwarder
extends Object implements TestListener

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


A class that listens to TestListener events and forwards them to an ITestInvocationListener.

Summary

Public constructors

JUnitToInvocationResultForwarder(ITestInvocationListener invocationListener)
JUnitToInvocationResultForwarder( invocationListeners)

Public methods

void addError(Test test, Throwable t)

void addFailure(Test test, AssertionFailedError t)

void endTest(Test test, metrics)

Callback from JUnit3 tests that can forward metrics.

void endTest(Test test)

void startTest(Test test)

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

Callback from JUnit3 forwarder in order to get the logs from a test.

Public constructors

JUnitToInvocationResultForwarder

public JUnitToInvocationResultForwarder (ITestInvocationListener invocationListener)

Parameters
invocationListener ITestInvocationListener

JUnitToInvocationResultForwarder

public JUnitToInvocationResultForwarder ( invocationListeners)

Parameters
invocationListeners

Public methods

addError

public void addError (Test test, 
                Throwable t)

Parameters
test Test

t Throwable

addFailure

public void addFailure (Test test, 
                AssertionFailedError t)

Parameters
test Test

t AssertionFailedError

endTest

public void endTest (Test test, 
                 metrics)

Callback from JUnit3 tests that can forward metrics.

Parameters
test Test: The Test that just finished running.

metrics : The metrics in a Map format to be passed to the results callback.

endTest

public void endTest (Test test)

Parameters
test Test

startTest

public void startTest (Test test)

Parameters
test Test

testLog

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

Callback from JUnit3 forwarder in order to get the logs from a test.

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.