CoverageMetadataCollector

public final class CoverageMetadataCollector
extends Object implements IConfigurationReceiver, ILogSaverListener

java.lang.Object
   ↳ com.google.android.tradefed.result.CoverageMetadataCollector


ILogSaverListener,可收集記錄的涵蓋範圍測量結果,並產生 CoverageMetadataProto,供 Android 程式碼涵蓋範圍服務處理。

摘要

公用建構函式

CoverageMetadataCollector()

公用方法

void invocationStarted(IInvocationContext context)

Reports the start of the test invocation.

void logAssociation(String unusedDataName, LogFile logFile)

在某些情況下,記錄必須與測試案例密切相關,但無法在直接 testLogSaved(String,LogDataType,InputStreamSource,LogFile) 回呼中執行這項操作。

void setConfiguration(IConfiguration configuration)

注入使用的 IConfiguration

void setLogSaver(ILogSaver logSaver)

設定 ILogSaver,允許實作者儲存檔案。

void testLogSaved(String unusedDataName, LogDataType dataType, InputStreamSource unusedDataStream, LogFile logFile)

測試記錄儲存完畢時呼叫。

void testModuleEnded()

回報模組執行作業的結束時間。

void testModuleStarted(IInvocationContext moduleContext)

回報模組的執行開始時間。

void testRunEnded(long elapsedTime, HashMap<String, MetricMeasurement.Metric> runMetrics)

Reports end of test run.

void testRunStarted(String runName, int testCount)

回報測試執行的開始。

公用建構函式

CoverageMetadataCollector

public CoverageMetadataCollector ()

公用方法

invocationStarted

public void invocationStarted (IInvocationContext context)

回報測試呼叫的開始時間。

TradeFederation 架構會自動呼叫這個方法。檢舉者需要覆寫這個方法,才能支援多部裝置回報。

參數
context IInvocationContext:叫用相關資訊

logAssociation

public void logAssociation (String unusedDataName, 
                LogFile logFile)

在某些情況下,記錄必須與測試案例密切相關,但無法在直接 testLogSaved(String,LogDataType,InputStreamSource,LogFile) 回呼中執行此操作。因此,這個回呼可明確提供強關聯。

參數
unusedDataName String:資料名稱

logFile LogFile:先前記錄的 LogFile,應與測試案例建立關聯。

setConfiguration

public void setConfiguration (IConfiguration configuration)

注入使用的 IConfiguration

參數
configuration IConfiguration

setLogSaver

public void setLogSaver (ILogSaver logSaver)

設定 ILogSaver,允許實作者儲存檔案。

參數
logSaver ILogSaverILogSaver

testLogSaved

public void testLogSaved (String unusedDataName, 
                LogDataType dataType, 
                InputStreamSource unusedDataStream, 
                LogFile logFile)

測試記錄儲存完畢時呼叫。

應取代 ITestInvocationListener.testLog(String,LogDataType,InputStreamSource) 使用。

參數
unusedDataName String:資料的String說明名稱,例如「device_logcat」。注意:dataName 在每次呼叫時可能不具唯一性,也就是說,實作者必須能夠處理具有相同 dataName 的多項呼叫。

dataType LogDataType:資料的 LogDataType

unusedDataStream InputStreamSource:資料的 InputStreamSource。實作者應呼叫 createInputStream 開始讀取資料,並確保在完成時關閉產生的 InputStream。

logFile LogFile:包含已儲存檔案中繼資料的 LogFile

testModuleEnded

public void testModuleEnded ()

回報模組執行作業的結束時間。

testModuleStarted

public void testModuleStarted (IInvocationContext moduleContext)

回報模組的執行開始時間。這個回呼與 testModuleEnded() 相關聯,且在序列中為選用項目。只有在使用模組的執行期間,才會使用這個標記:以套件為基礎的執行器。

參數
moduleContext IInvocationContext:模組的 IInvocationContext

testRunEnded

public void testRunEnded (long elapsedTime, 
                HashMap<String, MetricMeasurement.Metric> runMetrics)

測試執行結束時會回報。FIXME:我們無法使用不同型別的兩個 Map<> 介面,因此必須在此使用 HashMap。

參數
elapsedTime long:裝置回報的經過時間 (以毫秒為單位)

runMetrics HashMap:在測試執行結束時,使用 Metric 報告的鍵/值組合。

testRunStarted

public void testRunStarted (String runName, 
                int testCount)

回報測試執行的開始時間。

參數
runName String:測試執行名稱

testCount int:測試執行作業中的測試總數