LogcatOnFailureCollector

public class LogcatOnFailureCollector
extends BaseDeviceMetricCollector

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


收集器:在測試案例或測試執行失敗時擷取並記錄 logcat。如果啟用預設收集功能,系統會收集指定層級的主機記錄。

摘要

公用建構函式

LogcatOnFailureCollector()

公用方法

boolean captureModuleLevel()
void onTestEnd(DeviceMetricData testData, Map<String, MetricMeasurement.Metric> currentTestCaseMetrics)

測試案例結束時的回呼。

void onTestFail(DeviceMetricData testData, TestDescription test)

測試案例失敗時的回呼。

void onTestModuleEnded()

允許擷取模組結束事件。

void onTestModuleStarted()

允許擷取模組啟動事件。

void onTestRunEnd(DeviceMetricData runData, Map<String, MetricMeasurement.Metric> currentRunMetrics)

測試作業結束時的回呼。

void onTestRunFailed(DeviceMetricData testData, FailureDescription failure)

測試執行失敗事件的回呼

void onTestRunStart(DeviceMetricData runData)

測試執行開始時的回呼。

void onTestRunStartBlocking()
void onTestStart(DeviceMetricData testData)

測試案例啟動時的回呼。

受保護的方法

void collectAndLog(String testName, int size, IMetricCollector.MetricCollectionLevel level)

公用建構函式

LogcatOnFailureCollector

public LogcatOnFailureCollector ()

公用方法

captureModuleLevel

public boolean captureModuleLevel ()

傳回
boolean

onTestEnd

public void onTestEnd (DeviceMetricData testData, 
                Map<String, MetricMeasurement.Metric> currentTestCaseMetrics)

測試案例結束時的回呼。這時應進行清理。

參數
testData DeviceMetricData:保存測試案例資料的 DeviceMetricData。與 onTestStart(DeviceMetricData) 期間的物件相同。

currentTestCaseMetrics Map:傳遞至 testEnded(TestDescription,Map) 的指標目前對應。

擲回
DeviceNotAvailableException

onTestFail

public void onTestFail (DeviceMetricData testData, 
                TestDescription test)

測試案例失敗時的回呼。

參數
testData DeviceMetricData:保存測試案例資料的 DeviceMetricData

test TestDescription:進行中測試案例的 TestDescription

擲回
DeviceNotAvailableException

onTestModuleEnded

public void onTestModuleEnded ()

允許擷取模組結束事件。

擲回
DeviceNotAvailableException

onTestModuleStarted

public void onTestModuleStarted ()

允許擷取模組啟動事件。

擲回
DeviceNotAvailableException

onTestRunEnd

public void onTestRunEnd (DeviceMetricData runData, 
                Map<String, MetricMeasurement.Metric> currentRunMetrics)

測試作業結束時的回呼。這時應進行清理。

參數
runData DeviceMetricDataDeviceMetricData,其中包含執行作業的資料。與 onTestRunStart(DeviceMetricData) 期間的物件相同。

currentRunMetrics Map:傳遞至 testRunEnded(long,Map) 的指標目前對應。

擲回
DeviceNotAvailableException

onTestRunFailed

public void onTestRunFailed (DeviceMetricData testData, 
                FailureDescription failure)

testRunFailed 事件的回呼

擲回
DeviceNotAvailableException

onTestRunStart

public void onTestRunStart (DeviceMetricData runData)

測試執行開始時的回呼。

參數
runData DeviceMetricDataDeviceMetricData,其中包含執行作業的資料。

onTestRunStartBlocking

public void onTestRunStartBlocking ()

擲回
DeviceNotAvailableException

onTestStart

public void onTestStart (DeviceMetricData testData)

測試案例啟動時的回呼。

參數
testData DeviceMetricData:保存測試案例資料的 DeviceMetricData

受保護的方法

collectAndLog

protected void collectAndLog (String testName, 
                int size, 
                IMetricCollector.MetricCollectionLevel level)

參數
testName String

size int

level IMetricCollector.MetricCollectionLevel

擲回
DeviceNotAvailableException