TestResult

public class TestResult
extends Object

java.lang.Object
   ↳ com.android.tradefed.result.TestResult


Container for a result of a single test.

Summary

Public constructors

TestResult()

Public methods

void addLoggedFile(String dataName, LogFile loggedFile)

Add a logged file tracking associated with that test case

static TestResult clone(TestResult result)

Create an exact copy of given TestResult.

boolean equals(Object obj)
long getEndTime()

Return the System.currentTimeMillis() time that the ITestLifeCycleReceiver.testEnded(TestDescription, Map) event was received.

Map<String, LogFile> getLoggedFiles()

Returns a copy of the map containing all the logged file associated with that test case.

Map<String, String> getMetrics()

Get the associated test metrics.

HashMap<String, MetricMeasurement.Metric> getProtoMetrics()

Get the associated test metrics in proto format.

String getStackTrace()

Get the associated String stack trace.

long getStartTime()

Return the System.currentTimeMillis() time that the ITestLifeCycleReceiver.testStarted(TestDescription) event was received.

TestResult.TestStatus getStatus()

Get the TestResult.TestStatus result of the test.

int hashCode()
void setEndTime(long currentTimeMillis)

Sets the end time

void setMetrics(Map<String, String> metrics)

Set the test metrics, overriding any previous values.

void setProtoMetrics(HashMap<String, MetricMeasurement.Metric> metrics)

Set the test proto metrics format, overriding any previous values.

void setStackTrace(String trace)

Set the stack trace.

void setStartTime(long startTime)

Allows to set the time when the test was started, to be used with ITestLifeCycleReceiver.testStarted(TestDescription, long).

TestResult setStatus(TestResult.TestStatus status)

Set the TestResult.TestStatus.

Public constructors

TestResult

public TestResult ()

Public methods

addLoggedFile

public void addLoggedFile (String dataName, 
                LogFile loggedFile)

Add a logged file tracking associated with that test case

Parameters
dataName String

loggedFile LogFile

clone

public static TestResult clone (TestResult result)

Create an exact copy of given TestResult.

Parameters
result TestResult: The TestResult to copy from.

Returns
TestResult

equals

public boolean equals (Object obj)

Parameters
obj Object

Returns
boolean

getEndTime

public long getEndTime ()

Return the System.currentTimeMillis() time that the ITestLifeCycleReceiver.testEnded(TestDescription, Map) event was received.

Returns
long

getLoggedFiles

public Map<String, LogFile> getLoggedFiles ()

Returns a copy of the map containing all the logged file associated with that test case.

Returns
Map<String, LogFile>

getMetrics

public Map<String, String> getMetrics ()

Get the associated test metrics.

Returns
Map<String, String>

getProtoMetrics

public HashMap<String, MetricMeasurement.Metric> getProtoMetrics ()

Get the associated test metrics in proto format.

Returns
HashMap<String, MetricMeasurement.Metric>

getStackTrace

public String getStackTrace ()

Get the associated String stack trace. Should be null if getStatus() is TestResult.TestStatus.PASSED.

Returns
String

getStartTime

public long getStartTime ()

Return the System.currentTimeMillis() time that the ITestLifeCycleReceiver.testStarted(TestDescription) event was received.

Returns
long

getStatus

public TestResult.TestStatus getStatus ()

Get the TestResult.TestStatus result of the test.

Returns
TestResult.TestStatus

hashCode

public int hashCode ()

Returns
int

setEndTime

public void setEndTime (long currentTimeMillis)

Sets the end time

Parameters
currentTimeMillis long

setMetrics

public void setMetrics (Map<String, String> metrics)

Set the test metrics, overriding any previous values.

Parameters
metrics Map

setProtoMetrics

public void setProtoMetrics (HashMap<String, MetricMeasurement.Metric> metrics)

Set the test proto metrics format, overriding any previous values.

Parameters
metrics HashMap

setStackTrace

public void setStackTrace (String trace)

Set the stack trace.

Parameters
trace String

setStartTime

public void setStartTime (long startTime)

Allows to set the time when the test was started, to be used with ITestLifeCycleReceiver.testStarted(TestDescription, long).

Parameters
startTime long

setStatus

public TestResult setStatus (TestResult.TestStatus status)

Set the TestResult.TestStatus.

Parameters
status TestResult.TestStatus

Returns
TestResult