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 ()

公共方法

獲取有效指標

public  getValidMetrics ( collectedMetrics)

僅添加數字指標並跳過發布非數字指標。

參數
collectedMetrics :包含所有指標。

退貨
只有數字指標。

調用結束

public void invocationEnded (long elapsedTime)

報告調用已終止,無論是成功終止還是由於某些錯誤情況。

將由 TradeFederation 框架自動調用。

參數
elapsedTime long :調用經過的時間(以毫秒為單位)

調用失敗

public void invocationFailed (Throwable cause)

報告由於某些錯誤情況導致的不完整調用。

將由 TradeFederation 框架自動調用。

參數
cause Throwable : 失敗的ERROR(/Throwable)原因

調用開始

public void invocationStarted (IInvocationContext context)

報告測試調用的開始。

將由 TradeFederation 框架自動調用。記者需要覆蓋此方法以支持多設備報告。

參數
context IInvocationContext :有關調用的信息

受保護的方法

獲取設備

protected ITestDevice getDevice (IInvocationContext context)

參數
context IInvocationContext

退貨
ITestDevice

parseAdditionalDeviceDetails

protected void parseAdditionalDeviceDetails (ITestDevice testDevice)

從測試設備中檢索設備名稱、sdk 版本號和構建 ID。

參數
testDevice ITestDevice :從中收集信息的設備。

發布結果

protected void postResults (JSONObject postData)

將數據發佈到指定的 HTTP 端點

參數
postData JSONObject : 要發布的數據