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(List<ITestInvocationListener> invocationListeners)

Public methods

void addError(Test test, Throwable t)

void addFailure(Test test, AssertionFailedError t)

void endTest(Test test, Map<String, String> 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

JUnitToInvocationResultForwarder (ITestInvocationListener invocationListener)

Parameters
invocationListener ITestInvocationListener

JUnitToInvocationResultForwarder

JUnitToInvocationResultForwarder (List<ITestInvocationListener> invocationListeners)

Parameters
invocationListeners List

Public methods

addError

void addError (Test test, 
                Throwable t)

Parameters
test Test

t Throwable

addFailure

void addFailure (Test test, 
                AssertionFailedError t)

Parameters
test Test

t AssertionFailedError

endTest

void endTest (Test test, 
                Map<String, String> metrics)

Callback from JUnit3 tests that can forward metrics.

Parameters
test Test: The Test that just finished running.

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

endTest

void endTest (Test test)

Parameters
test Test

startTest

void startTest (Test test)

Parameters
test Test

testLog

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.