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 版本号和 build 号。 |
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 版本号和 build 号。
| 参数 | |
|---|---|
testDevice |
ITestDevice:要从中收集信息的设备。 |
postResults
protected void postResults (JSONObject postData)
将数据发布到指定的 HTTP 端点
| 参数 | |
|---|---|
postData |
JSONObject:要发布的数据 |