to top
public class

CodeCoverageReporter

extends StubTestInvocationListener
@OptionClass(alias = "code-coverage-reporter")
java.lang.Object
   ↳ com.android.tradefed.result.StubTestRunListener
     ↳ com.android.tradefed.result.StubTestInvocationListener
       ↳ com.android.tradefed.result.CodeCoverageReporter

Class Overview

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

Fields
public static String XML_REPORT_NAME
private String mCoverageMetaFilePath @Option(name = "coverage-metadata-file-path", description = "The path of the Emma coverage meta data file used to generate the report.")
private String mCoverageMetaZipFileName @Option(name = "coverage-metadata-label", description = "The label of the Emma coverage meta data zip file inside the IBuildInfo.")
private Integer mLogRetentionDays @Option(name = "log-retention-days", description = "The number of days to keep generated coverage files")
private String mReportRootPath @Option(name = "coverage-output-path", description = "The location where to store the html coverage reports.", mandatory = true)
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(IBuildInfo buildInfo)
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.
[Expand]
Inherited Methods
From class com.android.tradefed.result.StubTestInvocationListener
From class com.android.tradefed.result.StubTestRunListener
From class java.lang.Object
From interface com.android.tradefed.result.ITestInvocationListener
From interface com.android.ddmlib.testrunner.ITestRunListener

Fields

public static String XML_REPORT_NAME

private String mCoverageMetaFilePath

private String mCoverageMetaZipFileName

private Integer mLogRetentionDays

private String mReportRootPath

Public Constructors

public CodeCoverageReporter ()

Public Methods

public void generateReport ()

public File getHTMLReportFile ()

Returns
File

public File getReportOutputPath ()

Returns
File

public File getXMLReportFile ()

Returns
File

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

public void invocationStarted (IBuildInfo buildInfo)

Reports the start of the test invocation.

Will be automatically called by the TradeFederation framework.

Parameters
buildInfo IBuildInfo: information about the build being tested

public void setLogRetentionDays (Integer logRetentionDays)

Parameters
logRetentionDays Integer

public void setMetaZipFileName (String filename)

Parameters
filename String

public void setMetaZipFilePath (String filePath)

Parameters
filePath String

public void setReportRootPath (String rootPath)

Parameters
rootPath String

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