CodeCoverageTestBase
public
abstract
class
CodeCoverageTestBase
extends Object
implements
IDeviceTest,
IRemoteTest,
IBuildReceiver
java.lang.Object | |
↳ | com.android.tradefed.testtype.CodeCoverageTestBase<T extends com.android.tradefed.testtype.CodeCoverageReportFormat> |
An abstract base class which runs installed instrumentation test(s) and collects execution data
from each test that was run. Subclasses should implement the getReportFormat()
method
to convert the execution data into a human readable report and log it.
Summary
Nested classes | |
---|---|
class |
CodeCoverageTestBase.CoverageCollectingListener
A |
Public constructors | |
---|---|
CodeCoverageTestBase()
|
Public methods | |
---|---|
ITestDevice
|
getDevice()
Get the device under test. |
void
|
run(ITestInvocationListener listener)
Runs the tests, and reports result to the listener. |
void
|
setBuild(IBuildInfo buildInfo)
|
void
|
setDevice(ITestDevice device)
Inject the device under test. |
Protected methods | |
---|---|
void
|
cleanup()
Cleans up any resources allocated during a test run. |
abstract
File
|
generateCoverageReport(Collection<File> executionData, T format)
Generates a human-readable coverage report from the given execution data. |
abstract
List<T>
|
getReportFormat()
Returns the list of output formats to use when generating the coverage report. |
Public constructors
CodeCoverageTestBase
public CodeCoverageTestBase ()
Public methods
getDevice
public ITestDevice getDevice ()
Get the device under test.
Returns | |
---|---|
ITestDevice |
the ITestDevice
|
run
public void run (ITestInvocationListener listener)
Runs the tests, and reports result to the listener.
Parameters | |
---|---|
listener |
ITestInvocationListener : the ITestInvocationListener of test results |
Throws | |
---|---|
DeviceNotAvailableException |
setDevice
public void setDevice (ITestDevice device)
Inject the device under test.
Parameters | |
---|---|
device |
ITestDevice : the ITestDevice to use
|
Protected methods
cleanup
protected void cleanup ()
Cleans up any resources allocated during a test run. Called at the end of the
run(ITestInvocationListener)
after all coverage reports have been logged. This
method is a stub, but can be overridden by subclasses as necessary.
generateCoverageReport
protected abstract File generateCoverageReport (Collection<File> executionData, T format)
Generates a human-readable coverage report from the given execution data. This method is called after all of the tests have finished running.
Parameters | |
---|---|
executionData |
Collection : The execution data files collected while running the tests. |
format |
T : The output format of the generated coverage report.
|
Returns | |
---|---|
File |
Throws | |
---|---|
IOException |
getReportFormat
protected abstract List<T> getReportFormat ()
Returns the list of output formats to use when generating the coverage report.
Returns | |
---|---|
List<T> |
Interfaces
- CodeCoverageReportFormat
- IAbi
- IAbiReceiver
- IBuildReceiver
- IDeviceTest
- IInvocationContextReceiver
- IMultiDeviceTest
- INativeDeviceTest
- IRemoteTest
- IResumableTest
- IRetriableTest
- IRuntimeHintProvider
- ISetOptionReceiver
- IShardableTest
- IStrictShardableTest
- ITestAnnotationFilterReceiver
- ITestCollector
- ITestFileFilterReceiver
- ITestFilterReceiver
Classes
- Abi
- AndroidJUnitTest
- CodeCoverageListener
- CodeCoverageTest
- CodeCoverageTestBase
- CodeCoverageTestBase.CoverageCollectingListener
- CompanionAwareTest
- DeviceBatteryLevelChecker
- DeviceJUnit4ClassRunner
- DeviceJUnit4ClassRunner.LogAnnotation
- DeviceJUnit4ClassRunner.MetricAnnotation
- DeviceJUnit4ClassRunner.TestLogData
- DeviceJUnit4ClassRunner.TestMetrics
- DeviceSuite
- DeviceTestCase
- DeviceTestResult
- DeviceTestSuite
- FakeTest
- GoogleBenchmarkResultParser
- GoogleBenchmarkTest
- GTest
- GTestListTestParser
- GTestResultParser
- GTestXmlResultParser
- HostTest
- InstalledInstrumentationsTest
- InstrumentationFileTest
- InstrumentationSerialTest
- InstrumentationTest
- InstrumentationTest.FailedTestLogcatGenerator
- InstrumentationTest.FailedTestScreenshotGenerator
- JacocoCodeCoverageTest
- JUnitRunUtil
- MetricTestCase
- MetricTestCase.LogHolder
- NativeBenchmarkTest
- NativeBenchmarkTestParser
- NativeStressTest
- NativeStressTestParser
- NoisyDryRunTest
- PythonUnitTestResultParser
- PythonUnitTestRunner
- StubTest
- SubprocessTfLauncher
- TfTestLauncher
- UiAutomatorRunner
- UiAutomatorTest
- VersionedTfLauncher
Enums
Exceptions
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2019-10-02 UTC.