CodeCoverageTestBase.CoverageCollectingListener

public static class CodeCoverageTestBase.CoverageCollectingListener
extends ResultForwarder implements AutoCloseable

java.lang.Object
   ↳ com.android.tradefed.result.ResultForwarder
     ↳ com.android.tradefed.testtype.CodeCoverageTestBase.CoverageCollectingListener


A ResultForwarder which collects coverage files.

Summary

Public constructors

CodeCoverageTestBase.CoverageCollectingListener(ITestDevice device, ITestInvocationListener... listeners)

Public methods

void close()

List<File> getCoverageFiles()

Returns the list of collected coverage files.

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

Provides the associated log or debug data from the test invocation.

void testRunEnded(long elapsedTime, HashMap<String, MetricMeasurement.Metric> runMetrics)

Reports end of test run.

void testRunStarted(String runName, int testCount)

Reports the start of a test run.

Public constructors

CodeCoverageTestBase.CoverageCollectingListener

public CodeCoverageTestBase.CoverageCollectingListener (ITestDevice device, 
                ITestInvocationListener... listeners)

Parameters
device ITestDevice

listeners ITestInvocationListener

Throws
IOException

Public methods

close

public void close ()

getCoverageFiles

public List<File> getCoverageFiles ()

Returns the list of collected coverage files.

Returns
List<File>

testLog

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

Provides the associated log or debug data from the test invocation.

Must be called before ITestInvocationListener.invocationFailed(Throwable) or ITestInvocationListener.invocationEnded(long)

The TradeFederation framework will automatically call this method, providing the host log and if applicable, the device logcat.

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.

testRunEnded

public void testRunEnded (long elapsedTime, 
                HashMap<String, MetricMeasurement.Metric> runMetrics)

Reports end of test run. FIXME: We cannot have two Map<> interfaces with different type, so we have to use HashMap here.

Parameters
elapsedTime long: device reported elapsed time, in milliseconds

runMetrics HashMap: key-value pairs reported at the end of a test run with MetricMeasurement.Metric.

testRunStarted

public void testRunStarted (String runName, 
                int testCount)

Reports the start of a test run.

Parameters
runName String: the test run name

testCount int: total number of tests in test run