Google is committed to advancing racial equity for Black communities. See how.

JsonHttpTestResultReporter

public class JsonHttpTestResultReporter
extends CollectingTestListener

java.lang.Object
   ↳ com.android.tradefed.result.CollectingTestListener
     ↳ com.android.tradefed.result.JsonHttpTestResultReporter


A result reporter that encode test metrics results and branch, device info into JSON and POST into an HTTP service endpoint

Summary

Public constructors

JsonHttpTestResultReporter()

Public methods

getValidMetrics( collectedMetrics)

Add only the numeric metrics and skip posting the non-numeric metrics.

void invocationEnded(long elapsedTime)

void invocationFailed(Throwable cause)

void invocationStarted(IInvocationContext context)

Protected methods

ITestDevice getDevice(IInvocationContext context)
void parseAdditionalDeviceDetails(ITestDevice testDevice)

Retrieves the device name, sdk version number and the build id from the test device.

void postResults(JSONObject postData)

Post data to the specified HTTP endpoint

Public constructors

JsonHttpTestResultReporter

public JsonHttpTestResultReporter ()

Public methods

getValidMetrics

public  getValidMetrics ( collectedMetrics)

Add only the numeric metrics and skip posting the non-numeric metrics.

Parameters
collectedMetrics : contains all the metrics.

Returns
only the numeric metrics.

invocationEnded

public void invocationEnded (long elapsedTime)

Parameters
elapsedTime long

invocationFailed

public void invocationFailed (Throwable cause)

Parameters
cause Throwable

invocationStarted

public void invocationStarted (IInvocationContext context)

Parameters
context IInvocationContext

Protected methods

getDevice

protected ITestDevice getDevice (IInvocationContext context)

Parameters
context IInvocationContext

Returns
ITestDevice

parseAdditionalDeviceDetails

protected void parseAdditionalDeviceDetails (ITestDevice testDevice)

Retrieves the device name, sdk version number and the build id from the test device.

Parameters
testDevice ITestDevice: device to collect the information from.

postResults

protected void postResults (JSONObject postData)

Post data to the specified HTTP endpoint

Parameters
postData JSONObject: data to be posted