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)

Reports that the invocation has terminated, whether successfully or due to some error condition.

void invocationFailed(Throwable cause)

Reports an incomplete invocation due to some error condition.

void invocationStarted(IInvocationContext context)

Reports the start of the test invocation.

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)

Reports that the invocation has terminated, whether successfully or due to some error condition.

Will be automatically called by the TradeFederation framework.

Parameters
elapsedTime long: the elapsed time of the invocation in ms

invocationFailed

public void invocationFailed (Throwable cause)

Reports an incomplete invocation due to some error condition.

Will be automatically called by the TradeFederation framework.

Parameters
cause Throwable: the Throwable cause of the failure

invocationStarted

public void invocationStarted (IInvocationContext context)

Reports the start of the test invocation.

Will be automatically called by the TradeFederation framework. Reporters need to override this method to support multiple devices reporting.

Parameters
context IInvocationContext: information about the invocation

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