CodeCoverageReporter

public class CodeCoverageReporter
extends Object implements ITestInvocationListener

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


A ITestInvocationListener that will generate code coverage reports.

Used in conjunction with CodeCoverageTest. This assumes that emmalib.jar is in same filesystem location as ddmlib jar.

Summary

Constants

String XML_REPORT_NAME

Public constructors

CodeCoverageReporter()

Public methods

void generateReport()
File getHTMLReportFile()
File getReportOutputPath()
File getXMLReportFile()
void invocationEnded(long elapsedTime)

Reports that the invocation has terminated, whether successfully or due to some error condition.

void invocationStarted(IInvocationContext context)

Reports the start of the test invocation.

void setLogRetentionDays(Integer logRetentionDays)
void setMetaZipFileName(String filename)
void setMetaZipFilePath(String filePath)
void setReportRootPath(String rootPath)
void testLog(String dataName, LogDataType dataType, InputStreamSource dataStream)

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

Constants

XML_REPORT_NAME

String XML_REPORT_NAME

Constant Value: "report.xml"

Public constructors

CodeCoverageReporter

CodeCoverageReporter ()

Public methods

generateReport

void generateReport ()

getHTMLReportFile

File getHTMLReportFile ()

Returns
File

getReportOutputPath

File getReportOutputPath ()

Returns
File

getXMLReportFile

File getXMLReportFile ()

Returns
File

invocationEnded

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 long: the elapsed time of the invocation in ms

invocationStarted

void invocationStarted (IInvocationContext context)

Reports the start of the test invocation.

Will be automatically called by the TradeFederation framework. Reporters need to override this method to support multiple devices reporting.

Parameters
context IInvocationContext: information about the invocation

setLogRetentionDays

void setLogRetentionDays (Integer logRetentionDays)

Parameters
logRetentionDays Integer

setMetaZipFileName

void setMetaZipFileName (String filename)

Parameters
filename String

setMetaZipFilePath

void setMetaZipFilePath (String filePath)

Parameters
filePath String

setReportRootPath

void setReportRootPath (String rootPath)

Parameters
rootPath String

testLog

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