GcovCodeCoverageCollector

public final class GcovCodeCoverageCollector
extends BaseDeviceMetricCollector implements IConfigurationReceiver

java.lang.Object
   ↳ com.android.tradefed.device.metric.BaseDeviceMetricCollector
     ↳ com.android.tradefed.device.metric.GcovCodeCoverageCollector


BaseDeviceMetricCollector 會從裝置中提取 gcov 涵蓋率測量資料,並將其記錄為測試構件。

摘要

公用建構函式

GcovCodeCoverageCollector()

公用方法

ITestInvocationListener init(IInvocationContext context, ITestInvocationListener listener)

使用目前的內容和轉送結果的位置,初始化收集器。

void logCoverageMeasurements(String runName)

從裝置提取原生涵蓋率評估結果並記錄。

void onTestRunEnd(DeviceMetricData runData, runMetrics)

測試結束時的回呼。

void setCollectOnTestEnd(boolean collect)

設定是否要在 testRunEnded 上收集涵蓋率。

void setConfiguration(IConfiguration config)

插入正在使用的 IConfiguration

公用建構函式

GcovCodeCoverageCollector

public GcovCodeCoverageCollector ()

公用方法

init

public ITestInvocationListener init (IInvocationContext context, 
                ITestInvocationListener listener)

使用目前的內容和轉送結果的位置,初始化收集器。每個例項只會呼叫一次,且收集器應會更新其內部內容和事件監聽器。在測試執行期間,系統一律不會呼叫初始化。

除非您知道自己在做什麼,否則請勿覆寫。

參數
context IInvocationContext:正在進行叫用作業的 IInvocationContext

listener ITestInvocationListener:放置結果的 ITestInvocationListener

傳回
ITestInvocationListener 新的事件監聽器會包裝原始事件監聽器。

logCoverageMeasurements

public void logCoverageMeasurements (String runName)

從裝置提取原生涵蓋率評估結果並記錄。

參數
runName String

onTestRunEnd

public void onTestRunEnd (DeviceMetricData runData, 
                 runMetrics)

測試結束時的回呼。這時應該要清理了。

參數
runData DeviceMetricData:儲存執行作業資料的 DeviceMetricData。會與 BaseDeviceMetricCollector.onTestRunStart(com.android.tradefed.device.metric.DeviceMetricData) 期間相同的物件。

runMetrics :傳遞至 ITestLifeCycleReceiver.testRunEnded(long, Map) 的目前指標對應項目。

setCollectOnTestEnd

public void setCollectOnTestEnd (boolean collect)

設定是否要在 testRunEnded 上收集涵蓋率。

請在重新執行期間將此值設為 false,否則每個個別測試重新執行作業都會收集涵蓋率,而非取得單一合併的涵蓋率結果。

參數
collect boolean

setConfiguration

public void setConfiguration (IConfiguration config)

插入正在使用的 IConfiguration

參數
config IConfiguration