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

boolean equals(Object obj)
long getEndTime()

Return the System.currentTimeMillis() time that the ERROR(ITestInvocationListener#testEnded(TestDescription, Map)/com.android.tradefed.result.ITestInvocationListener#testEnded(com.android.tradefed.result.TestDescription,Map) ITestInvocationListener#testEnded(TestDescription, Map)) event was received.

getLoggedFiles()

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

getMetrics()

Get the associated test metrics.

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 ITestInvocationListener#testStarted(TestDescription) event was received.

TestResult.TestStatus getStatus()

Get the TestStatus result of the test.

int hashCode()
static TestResult merge( results, MergeStrategy strategy)

Merge the attempts for a same test case based on the merging strategy.

void setEndTime(long currentTimeMillis)

Sets the end time

void setMetrics( metrics)

Set the test metrics, overriding any previous values.

void setProtoMetrics( 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 ITestInvocationListener#testStarted(TestDescription, long).

TestResult setStatus(TestResult.TestStatus status)

Set the 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

equals

public boolean equals (Object obj)

Parameters
obj Object

Returns
boolean

getLoggedFiles

public  getLoggedFiles ()

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

Returns

getMetrics

public  getMetrics ()

Get the associated test metrics.

Returns

getProtoMetrics

public  getProtoMetrics ()

Get the associated test metrics in proto format.

Returns

getStackTrace

public String getStackTrace ()

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

Returns
String

getStartTime

public long getStartTime ()

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

Returns
long

getStatus

public TestResult.TestStatus getStatus ()

Get the TestStatus result of the test.

Returns
TestResult.TestStatus

hashCode

public int hashCode ()

Returns
int

merge

public static TestResult merge ( results, 
                MergeStrategy strategy)

Merge the attempts for a same test case based on the merging strategy.

Parameters
results : List of TestResult that will be merged

strategy MergeStrategy: the MergeStrategy to be used to determine the merging outcome.

Returns
TestResult the merged TestResult or null if there is nothing to merge.

setEndTime

public void setEndTime (long currentTimeMillis)

Sets the end time

Parameters
currentTimeMillis long

setMetrics

public void setMetrics ( metrics)

Set the test metrics, overriding any previous values.

Parameters
metrics

setProtoMetrics

public void setProtoMetrics ( metrics)

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

Parameters
metrics

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 ITestInvocationListener#testStarted(TestDescription, long).

Parameters
startTime long

setStatus

public TestResult setStatus (TestResult.TestStatus status)

Set the TestStatus.

Parameters
status TestResult.TestStatus

Returns
TestResult