TestResult

public class TestResult
extends Object

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


Container for a result of a single test.

Summary

Fields

public static final String IS_FLAKY

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(/com.android.tradefed.result.ITestInvocationListener#testEnded(com.android.tradefed.result.TestDescription,Map)) event was received.

FailureDescription getFailure()

Get the associated FailureDescription.

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.

TestStatus getResultStatus()

Get the TestStatus result of the test.

SkipReason getSkipReason()
String getStackTrace()

Get the associated String stack trace.

long getStartTime()

Return the System.currentTimeMillis() time that the ITestLifeCycleReceiver.testStarted(com.android.tradefed.result.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 setFailure(FailureDescription failureDescription)

Set the stack trace.

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 setSkipReason(SkipReason reason)
void setStackTrace(String stackTrace)

Set the stack trace.

void setStartTime(long startTime)

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

TestResult setStatus(TestStatus status)

Set the TestStatus.

TestResult setStatus(TestResult.TestStatus ddmlibStatus)

Fields

IS_FLAKY

public static final String IS_FLAKY

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

getEndTime

public long getEndTime ()

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

Returns
long

getFailure

public FailureDescription getFailure ()

Get the associated FailureDescription. Should be null if getStatus() is TestStatus.PASSED.

Returns
FailureDescription

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

getResultStatus

public TestStatus getResultStatus ()

Get the TestStatus result of the test.

Returns
TestStatus

getSkipReason

public SkipReason getSkipReason ()

Returns
SkipReason

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 ITestLifeCycleReceiver.testStarted(com.android.tradefed.result.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

setFailure

public void setFailure (FailureDescription failureDescription)

Set the stack trace.

Parameters
failureDescription FailureDescription

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

setSkipReason

public void setSkipReason (SkipReason reason)

Parameters
reason SkipReason

setStackTrace

public void setStackTrace (String stackTrace)

Set the stack trace.

Parameters
stackTrace String

setStartTime

public void setStartTime (long startTime)

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

Parameters
startTime long

setStatus

public TestResult setStatus (TestStatus status)

Set the TestStatus.

Parameters
status TestStatus

Returns
TestResult

setStatus

public TestResult setStatus (TestResult.TestStatus ddmlibStatus)

Parameters
ddmlibStatus TestResult.TestStatus

Returns
TestResult