MetricTestCase
public
class
MetricTestCase
extends TestCase
| java.lang.Object | |||
| ↳ | junit.framework.Assert | ||
| ↳ | junit.framework.TestCase | ||
| ↳ | com.android.tradefed.testtype.MetricTestCase | ||
TestCase 的擴充功能,可讓您在以 TradeFed 的一部分執行時記錄指標。直接做為 DeviceTestCase,或做為 HostTest 的一部分。TODO:評估是否要為 JUnit3 測試提供執行指標 (不只是測試指標)。
摘要
巢狀類別 | |
|---|---|
class |
MetricTestCase.LogHolder
用來保存要回報的記錄檔的結構。 |
欄位 | |
|---|---|
public
List<MetricTestCase.LogHolder> |
mLogs
|
public
HashMap<String, MetricMeasurement.Metric> |
mMetrics
|
公用建構函式 | |
|---|---|
MetricTestCase()
|
|
MetricTestCase(String name)
使用指定名稱建構測試案例。 |
|
公用方法 | |
|---|---|
final
void
|
addTestLog(String dataName, LogDataType dataType, InputStreamSource dataStream)
JUnit3 轉送程式的回呼,用於從測試取得記錄。 |
final
void
|
addTestMetric(String key, MetricMeasurement.Metric metric)
|
final
void
|
addTestMetric(String key, String value)
記錄測試案例的指標。 |
欄位
mMetrics
public HashMap<String, MetricMeasurement.Metric> mMetrics
公用建構函式
MetricTestCase
public MetricTestCase ()
公用方法
addTestLog
public final void addTestLog (String dataName,
LogDataType dataType,
InputStreamSource dataStream)JUnit3 轉送程式的回呼,用於從測試取得記錄。
| 參數 | |
|---|---|
dataName |
String:資料的說明名稱字串,例如「device_logcat」。注意:dataName 可能不會在每次叫用時保持不重複,也就是說,實作者必須能夠處理具有相同 dataName 的多項呼叫。 |
dataType |
LogDataType:資料的 LogDataType |
dataStream |
InputStreamSource:資料的 InputStreamSource。實作者應呼叫 createInputStream 開始讀取資料,並確保在完成時關閉產生的 InputStream。呼叫端應確保資料來源持續存在且可存取,直到 testLog 方法完成為止。 |
addTestMetric
public final void addTestMetric (String key,
MetricMeasurement.Metric metric)| 參數 | |
|---|---|
key |
String |
metric |
MetricMeasurement.Metric |
addTestMetric
public final void addTestMetric (String key,
String value)記錄測試案例的指標。
| 參數 | |
|---|---|
key |
String:指標所在的鍵。 |
value |
String:與金鑰相關聯。 |