Interface ITestResult
- All Superinterfaces:
Comparable<ITestResult>, IAttributes
- All Known Implementing Classes:
TestResult
This class describes the result of a test.
- Since:
- May 2, 2004
- Version:
- $Revision: 721 $, $Date: 2009-05-23 09:55:46 -0700 (Sat, 23 May 2009) $
- Author:
- Cedric Beust, May 2, 2004
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionlongObject[]getHost()getName()Object[]default List<ITestNGMethod> longintid()default booleanbooleanvoidsetEndMillis(long millis) voidsetParameters(Object[] parameters) voidsetStatus(int status) voidsetTestName(String name) voidsetThrowable(Throwable throwable) voidsetWasRetried(boolean wasRetried) static booleanwasFailureDueToTimeout(ITestResult result) booleanMethods inherited from interface Comparable
compareToMethods inherited from interface IAttributes
getAttribute, getAttributeNames, removeAttribute, setAttribute
-
Field Details
-
CREATED
static final int CREATED- See Also:
-
SUCCESS
static final int SUCCESS- See Also:
-
FAILURE
static final int FAILURE- See Also:
-
SKIP
static final int SKIP- See Also:
-
SUCCESS_PERCENTAGE_FAILURE
static final int SUCCESS_PERCENTAGE_FAILURE- See Also:
-
STARTED
static final int STARTED- See Also:
-
-
Method Details
-
getStatus
int getStatus()- Returns:
- The status of this result, using one of the constants above.
-
setStatus
void setStatus(int status) -
getMethod
ITestNGMethod getMethod()- Returns:
- The test method this result represents.
-
getParameters
Object[] getParameters()- Returns:
- The parameters this method was invoked with.
-
setParameters
-
getTestClass
IClass getTestClass()- Returns:
- The test class used this object is a result for.
-
getThrowable
Throwable getThrowable()- Returns:
- The throwable that was thrown while running the method, or null if no exception was thrown.
-
setThrowable
-
getStartMillis
long getStartMillis()- Returns:
- the start date for this test, in milliseconds.
-
getEndMillis
long getEndMillis()- Returns:
- the end date for this test, in milliseconds.
-
setEndMillis
void setEndMillis(long millis) -
getName
String getName()- Returns:
- The name of this TestResult, typically identical to the name of the method.
-
isSuccess
boolean isSuccess()- Returns:
- true if if this test run is a SUCCESS
-
getHost
String getHost()- Returns:
- The host where this suite was run, or null if it was run locally. The returned string has the form: host:port
-
getInstance
Object getInstance()- Returns:
- The instance on which this method was run.
-
getFactoryParameters
Object[] getFactoryParameters()- Returns:
- - A parameter array that was passed to a factory method (or) an empty object array otherwise.
-
getTestName
String getTestName()- Returns:
- The test name if this result's related instance implements ITest or use @Test(testName=...), null otherwise.
-
getInstanceName
String getInstanceName() -
getTestContext
ITestContext getTestContext()- Returns:
- the
ITestContextfor this test result.
-
setTestName
- Parameters:
name- - The new name to be used as a test name
-
wasRetried
boolean wasRetried()- Returns:
- -
trueif the test was retried again by an implementation ofIRetryAnalyzer
-
setWasRetried
void setWasRetried(boolean wasRetried) - Parameters:
wasRetried- -trueif the test was retried andfalseotherwise.
-
getSkipCausedBy
- Returns:
- - The list of either upstream method(s) or configuration method(s) whose failure led to the current method being skipped. An empty list is returned when the current method is not a skipped method.
-
id
String id()- Returns:
- - A unique id for the current JVM that represents a unique way of identifying a specific test method's result.
-
isNotRunning
-
finalStatuses
-
wasFailureDueToTimeout
- Parameters:
result- - The test result of a method- Returns:
- -
trueif the test failure was due to a timeout.
-