JsonHttpTestResultReporter
public class JsonHttpTestResultReporter
extends CollectingTestListener
java.lang.Object | ||
↳ | com.android.tradefed.result.CollectingTestListener | |
↳ | com.android.tradefed.result.JsonHttpTestResultReporter |
結果報告器,將測試指標結果和分支、設備信息編碼為 JSON 並 POST 到 HTTP 服務端點
概括
公共構造函數 | |
---|---|
JsonHttpTestResultReporter () |
公共方法 | |
---|---|
getValidMetrics ( collectedMetrics) getValidMetrics ( collectedMetrics) 僅添加數字指標並跳過發布非數字指標。 | |
void | invocationEnded (long elapsedTime) 報告調用已終止,無論是成功還是由於某些錯誤情況。 |
void | invocationFailed (Throwable cause) 由於某些錯誤情況而報告不完整的調用。 |
void | invocationStarted ( IInvocationContext context) 報告測試調用的開始。 |
受保護的方法 | |
---|---|
ITestDevice | getDevice ( IInvocationContext context) |
void | parseAdditionalDeviceDetails ( ITestDevice testDevice) 從測試設備中檢索設備名稱、sdk 版本號和構建 ID。 |
void | postResults (JSONObject postData) 將數據發佈到指定的 HTTP 端點 |
公共構造函數
JsonHttpTestResultReporter
public JsonHttpTestResultReporter ()
公共方法
獲取有效指標
publicgetValidMetrics ( collectedMetrics)
僅添加數字指標並跳過發布非數字指標。
參數 | |
---|---|
collectedMetrics |
退貨 | |
---|---|
僅數字指標。 |
調用結束
public void invocationEnded (long elapsedTime)
報告調用已終止,無論是成功還是由於某些錯誤情況。
將由 TradeFederation 框架自動調用。參數 | |
---|---|
elapsedTime | long :調用所用的時間(以毫秒為單位) |
調用失敗
public void invocationFailed (Throwable cause)
由於某些錯誤情況而報告不完整的調用。
將由 TradeFederation 框架自動調用。參數 | |
---|---|
cause | Throwable :失敗的Throwable 原因 |
調用開始
public void invocationStarted (IInvocationContext context)
報告測試調用的開始。
將由 TradeFederation 框架自動調用。記者需要重寫此方法以支持多設備報告。
參數 | |
---|---|
context | IInvocationContext :有關調用的信息 |
受保護的方法
獲取設備
protected ITestDevice getDevice (IInvocationContext context)
參數 | |
---|---|
context | IInvocationContext |
退貨 | |
---|---|
ITestDevice |
解析附加設備詳細信息
protected void parseAdditionalDeviceDetails (ITestDevice testDevice)
從測試設備中檢索設備名稱、sdk 版本號和構建 ID。
參數 | |
---|---|
testDevice | ITestDevice :從中收集信息的設備。 |
發布結果
protected void postResults (JSONObject postData)
將數據發佈到指定的 HTTP 端點
參數 | |
---|---|
postData | JSONObject :要發布的數據 |