JsonHttpTestResultReporter
public
class
JsonHttpTestResultReporter
extends CollectingTestListener
| java.lang.Object | ||
| ↳ | com.android.tradefed.result.CollectingTestListener | |
| ↳ | com.android.tradefed.result.JsonHttpTestResultReporter | |
結果回報器,將測試指標結果和分支、裝置資訊編碼為 JSON,並將其 POST 至 HTTP 服務端點
摘要
公用建構函式 | |
|---|---|
JsonHttpTestResultReporter()
|
|
公用方法 | |
|---|---|
|
getValidMetrics(
只新增數值指標,並略過發布非數值指標。 |
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 ()
公用方法
getValidMetrics
publicgetValidMetrics ( collectedMetrics)
只新增數值指標,並略過非數值指標。
| 參數 | |
|---|---|
collectedMetrics |
:包含所有指標。 |
| 傳回 | |
|---|---|
|
只顯示數值指標。 |
invocationEnded
public void invocationEnded (long elapsedTime)
回報叫用已終止,無論是成功或因某些錯誤條件而終止。
會由 TradeFederation 架構自動呼叫。
| 參數 | |
|---|---|
elapsedTime |
long:叫用作業的經過時間 (以毫秒為單位) |
invocationFailed
public void invocationFailed (Throwable cause)
由於某些錯誤情況,因此回報未完成的叫用作業。
會由 TradeFederation 架構自動呼叫。
| 參數 | |
|---|---|
cause |
Throwable:失敗的 Throwable 原因 |
invocationStarted
public void invocationStarted (IInvocationContext context)
回報測試叫用作業的開始時間。
會由 TradeFederation 架構自動呼叫。回報器需要覆寫這個方法,才能支援多裝置回報。
| 參數 | |
|---|---|
context |
IInvocationContext:叫用作業相關資訊 |
受保護的方法
getDevice
protected ITestDevice getDevice (IInvocationContext context)
| 參數 | |
|---|---|
context |
IInvocationContext |
| 傳回 | |
|---|---|
ITestDevice |
|
parseAdditionalDeviceDetails
protected void parseAdditionalDeviceDetails (ITestDevice testDevice)
從測試裝置擷取裝置名稱、SDK 版本號碼和版本 ID。
| 參數 | |
|---|---|
testDevice |
ITestDevice:要收集資訊的裝置。 |
postResults
protected void postResults (JSONObject postData)
將資料張貼至指定的 HTTP 端點
| 參數 | |
|---|---|
postData |
JSONObject:要發布的資料 |