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)
| 参数 | |
|---|---|
| elapsedTime | long | 
invocationFailed
public void invocationFailed (Throwable cause)
| 参数 | |
|---|---|
| cause | Throwable | 
invocationStarted
public void invocationStarted (IInvocationContext context)
| 参数 | |
|---|---|
| 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:要发布的数据 | 
