Google is committed to advancing racial equity for Black communities. See how.
This page was translated by the Cloud Translation API.
Switch to English

BaseDeviceMetricCollector

public class BaseDeviceMetricCollector
extends Object implements IMetricCollector

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


IMetricCollector基本實現,它允許在onTestRunStart(com.android.tradefed.device.metric.DeviceMetricData)ERROR(/#onTestRunEnd(com.android.tradefed.device.metric.DeviceMetricData,Map))上啟動和停止收集。

摘要

領域

public static final String TEST_CASE_EXCLUDE_GROUP_OPTION

public static final String TEST_CASE_INCLUDE_GROUP_OPTION

公共建設者

BaseDeviceMetricCollector ()

公開方法

final getBuildInfos ()

返回調用中可用的構建信息列表。

final getDevices ()

返回調用中可用的設備列表。

File getFileFromTestArtifacts (String fileName)

從測試工件或模塊工件中檢索文件,並將其緩存在映射中以供後續調用。

final ITestInvocationListener getInvocationListener ()

返回原始ITestInvocationListener ,我們在其中轉發結果。

final getRealDevices ()

返回getDevices()列表中的所有非存根設備。

String getRunName ()

返回觸發收集器的測試運行mRunName的名稱。

String getTag ()

返回收集器的標識符mTag

ITestInvocationListener init (IInvocationContext context, ITestInvocationListener listener)

使用當前上下文以及將結果轉發到何處來初始化收集器。

final void invocationEnded (long elapsedTime)
final void invocationFailed (FailureDescription failure)
final void invocationFailed (Throwable cause)
final void invocationStarted (IInvocationContext context)

調用偵聽器進行轉發

final boolean isDisabled ()

如果禁用了整個對象(跳過設置和拆卸),則返回True。

void onTestAssumptionFailure ( DeviceMetricData testData, TestDescription test)

當測試用例失敗且假設失敗時進行回調。

void onTestEnd ( DeviceMetricData testData, currentTestCaseMetrics, TestDescription test) onTestEnd ( DeviceMetricData testData, currentTestCaseMetrics, TestDescription test)

測試用例結束時的回調。

void onTestEnd ( DeviceMetricData testData, currentTestCaseMetrics) onTestEnd ( DeviceMetricData testData, currentTestCaseMetrics)

測試用例結束時的回調。

void onTestFail ( DeviceMetricData testData, TestDescription test)

測試用例失敗時回調。

void onTestRunEnd ( DeviceMetricData runData, currentRunMetrics) onTestRunEnd ( DeviceMetricData runData, currentRunMetrics)

測試運行結束時回調。

void onTestRunStart ( DeviceMetricData runData)

開始測試運行時的回調。

void onTestStart ( DeviceMetricData testData)

測試用例啟動時的回調。

final void setDisable (boolean isDisabled)

設置是否應禁用對象。

void setTag (String tag)

設置收集器的mTag

final void testAssumptionFailure (TestDescription test, String trace)
final void testAssumptionFailure (TestDescription test, FailureDescription failure)
final void testEnded (TestDescription test, long endTime, testMetrics) testEnded (TestDescription test, long endTime, testMetrics)
final void testEnded (TestDescription test, testMetrics) testEnded (TestDescription test, testMetrics)
final void testFailed (TestDescription test, FailureDescription failure)
final void testFailed (TestDescription test, String trace)
final void testIgnored (TestDescription test)
final void testLog (String dataName, LogDataType dataType, InputStreamSource dataStream)
final void testModuleEnded ()
final void testModuleStarted (IInvocationContext moduleContext)
final void testRunEnded (long elapsedTime, runMetrics) testRunEnded (long elapsedTime, runMetrics)
final void testRunFailed (FailureDescription failure)
final void testRunFailed (String errorMessage)
final void testRunStarted (String runName, int testCount, int attemptNumber)
final void testRunStarted (String runName, int testCount)

測試運行回調

final void testRunStarted (String runName, int testCount, int attemptNumber, long startTime)
final void testRunStopped (long elapsedTime)
final void testStarted (TestDescription test, long startTime)
final void testStarted (TestDescription test)

測試用例回調

領域

TEST_CASE_EXCLUDE_GROUP_OPTION

public static final String TEST_CASE_EXCLUDE_GROUP_OPTION

TEST_CASE_INCLUDE_GROUP_OPTION

public static final String TEST_CASE_INCLUDE_GROUP_OPTION

公共建設者

BaseDeviceMetricCollector

public BaseDeviceMetricCollector ()

公開方法

getBuildInfos

public final  getBuildInfos ()

返回調用中可用的構建信息列表。

退貨

getDevices

public final  getDevices ()

返回調用中可用的設備列表。

退貨

getFileFromTestArtifacts

public File getFileFromTestArtifacts (String fileName)

從測試工件或模塊工件中檢索文件,並將其緩存在映射中以供後續調用。

參量
fileName String :要在構件中查找的文件的名稱。

退貨
File 來自測試工件或模塊工件的文件。如果找不到文件,則返回null。

getInvocationListener

public final ITestInvocationListener getInvocationListener ()

返回原始ITestInvocationListener ,我們在其中轉發結果。

退貨
ITestInvocationListener

getRealDevices

public final  getRealDevices ()

getDevices()列表返回所有非存根設備。

退貨

getRunName

public String getRunName ()

返回觸發收集器的測試運行mRunName的名稱。

退貨
String mRunName,當前的測試運行名稱。

getTag

public String getTag ()

返回收集器的標識符mTag

退貨
String mTag,收集器的唯一標識符。

在裡面

public ITestInvocationListener init (IInvocationContext context, 
                ITestInvocationListener listener)

使用當前上下文以及將結果轉發到何處來初始化收集器。每個實例僅被調用一次,並且收集器應更新其內部上下文和偵聽器。永遠不會在測試運行之前調用Init。

除非您知道自己在做什麼,否則不要覆蓋。

參量
context IInvocationContextIInvocationContext的調用的IInvocationContext

listener ITestInvocationListener :將結果ITestInvocationListener哪裡的ITestInvocationListener

退貨
ITestInvocationListener 新的監聽器包裝了原來的監聽器。

調用結束

public final void invocationEnded (long elapsedTime)

參量
elapsedTime long

調用失敗

public final void invocationFailed (FailureDescription failure)

參量
failure FailureDescription

調用失敗

public final void invocationFailed (Throwable cause)

參量
cause Throwable

調用開始

public final void invocationStarted (IInvocationContext context)

調用偵聽器進行轉發

參量
context IInvocationContext

被禁用

public final boolean isDisabled ()

如果禁用了整個對象(跳過設置和拆卸),則返回True。否則為假。

退貨
boolean

onTestAssumptionFailure

public void onTestAssumptionFailure (DeviceMetricData testData, 
                TestDescription test)

當測試用例失敗且假設失敗時進行回調。

參量
testData DeviceMetricData :保存測試用例數據的DeviceMetricData

test TestDescriptionTestDescription的測試用例的TestDescription

onTestEnd

public void onTestEnd (DeviceMetricData testData, 
                 currentTestCaseMetrics, 
                TestDescription test)

測試用例結束時的回調。這應該是清理的時候了。

參量
testData DeviceMetricData :保存測試用例數據的DeviceMetricData 。與onTestStart(com.android.tradefed.device.metric.DeviceMetricData)期間的對象相同。

currentTestCaseMetrics :傳遞給ITestLifeCycleReceiver.testEnded(com.android.tradefed.result.TestDescription, Map)的度量的當前映射。

test TestDescriptionTestDescription的測試用例的TestDescription

onTestEnd

public void onTestEnd (DeviceMetricData testData, 
                 currentTestCaseMetrics)

測試用例結束時的回調。這應該是清理的時候了。

參量
testData DeviceMetricData :保存測試用例數據的DeviceMetricData 。與onTestStart(com.android.tradefed.device.metric.DeviceMetricData)期間的對象相同。

currentTestCaseMetrics :傳遞給ITestLifeCycleReceiver.testEnded(com.android.tradefed.result.TestDescription, Map)的度量的當前映射。

onTestFail

public void onTestFail (DeviceMetricData testData, 
                TestDescription test)

測試用例失敗時回調。

參量
testData DeviceMetricData :保存測試用例數據的DeviceMetricData

test TestDescriptionTestDescription的測試用例的TestDescription

onTestRunEnd

public void onTestRunEnd (DeviceMetricData runData, 
                 currentRunMetrics)

測試運行結束時回調。這應該是清理的時候了。

參量
runData DeviceMetricData :保存運行數據的DeviceMetricData 。與onTestRunStart(com.android.tradefed.device.metric.DeviceMetricData)期間的對象相同。

currentRunMetrics :傳遞給ITestLifeCycleReceiver.testRunEnded(long, Map)的度量的當前映射。

onTestRunStart

public void onTestRunStart (DeviceMetricData runData)

開始測試運行時的回調。

參量
runData DeviceMetricData :保存運行數據的DeviceMetricData

onTestStart

public void onTestStart (DeviceMetricData testData)

測試用例啟動時的回調。

參量
testData DeviceMetricData :保存測試用例數據的DeviceMetricData

setDisable

public final void setDisable (boolean isDisabled)

設置是否應禁用對象。禁用表示應跳過設置和拆卸步驟。可用於使對像在默認構造函數中默認為禁用。

參量
isDisabled boolean :對象應置於的狀態。

setTag

public void setTag (String tag)

設置收集器的mTag 。可用於指定收集器的間隔。

參量
tag String :收集器的唯一標識符。

testAssumptionFailure

public final void testAssumptionFailure (TestDescription test, 
                String trace)

參量
test TestDescription

trace String

testAssumptionFailure

public final void testAssumptionFailure (TestDescription test, 
                FailureDescription failure)

參量
test TestDescription

failure FailureDescription

testEnded

public final void testEnded (TestDescription test, 
                long endTime, 
                 testMetrics)

參量
test TestDescription

endTime long

testMetrics

testEnded

public final void testEnded (TestDescription test, 
                 testMetrics)

參量
test TestDescription

testMetrics

測試失敗

public final void testFailed (TestDescription test, 
                FailureDescription failure)

參量
test TestDescription

failure FailureDescription

測試失敗

public final void testFailed (TestDescription test, 
                String trace)

參量
test TestDescription

trace String

testIgnored

public final void testIgnored (TestDescription test)

參量
test TestDescription

測試日誌

public final void testLog (String dataName, 
                LogDataType dataType, 
                InputStreamSource dataStream)

參量
dataName String

dataType LogDataType

dataStream InputStreamSource

testModuleEnded

public final void testModuleEnded ()

testModuleStarted

public final void testModuleStarted (IInvocationContext moduleContext)

參量
moduleContext IInvocationContext

testRunEnded

public final void testRunEnded (long elapsedTime, 
                 runMetrics)

參量
elapsedTime long

runMetrics

testRunFailed

public final void testRunFailed (FailureDescription failure)

參量
failure FailureDescription

testRunFailed

public final void testRunFailed (String errorMessage)

參量
errorMessage String

testRunStarted

public final void testRunStarted (String runName, 
                int testCount, 
                int attemptNumber)

參量
runName String

testCount int

attemptNumber int

testRunStarted

public final void testRunStarted (String runName, 
                int testCount)

測試運行回調

參量
runName String

testCount int

testRunStarted

public final void testRunStarted (String runName, 
                int testCount, 
                int attemptNumber, 
                long startTime)

參量
runName String

testCount int

attemptNumber int

startTime long

testRunStopped

public final void testRunStopped (long elapsedTime)

參量
elapsedTime long

testStarted

public final void testStarted (TestDescription test, 
                long startTime)

參量
test TestDescription

startTime long

testStarted

public final void testStarted (TestDescription test)

測試用例回調

參量
test TestDescription