指標測試用例
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 | mLogs |
public | 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) 記錄測試用例的指標。 |
領域
日誌
publicmLogs
指標
publicmMetrics
公共構造函數
指標測試用例
public MetricTestCase ()
公共方法
添加測試日誌
public final void addTestLog (String dataName, LogDataType dataType, InputStreamSource dataStream)
從 JUnit3 轉發器回調,以便從測試中獲取日誌。
參數 | |
---|---|
dataName | String :數據的 String 描述性名稱。例如“device_logcat”。注意 dataName 每次調用可能不是唯一的。即實現者必須能夠處理具有相同數據名的多個調用 |
dataType | LogDataType :數據的 LogDataType |
dataStream | InputStreamSource :數據的 InputStreamSource。實施者應調用 createInputStream 開始讀取數據,並確保在完成後關閉生成的 InputStream。調用者應確保數據源保持存在且可訪問,直到 testLog 方法完成。 |
添加測試指標
public final void addTestMetric (String key, MetricMeasurement.Metric metric)
參數 | |
---|---|
key | String |
metric | MetricMeasurement.Metric |
添加測試指標
public final void addTestMetric (String key, String value)
記錄測試用例的指標。
參數 | |
---|---|
key | String :將在其下找到指標的鍵。 |
value | String :與鍵關聯。 |
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2023-03-30 (世界標準時間)。
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"缺少我需要的資訊"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"過於複雜/步驟過多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"過時"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻譯問題"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/程式碼問題"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"容易理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"確實解決了我的問題"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]