Package org.testng
Interface ITestResult
-
- All Superinterfaces:
java.lang.Comparable<ITestResult>
,IAttributes
public interface ITestResult extends IAttributes, java.lang.Comparable<ITestResult>
This class describes the result of a test.- Since:
- May 2, 2004
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static java.util.List<java.lang.String>
finalStatuses()
long
getEndMillis()
java.lang.Object[]
getFactoryParameters()
java.lang.String
getHost()
java.lang.Object
getInstance()
java.lang.String
getInstanceName()
ITestNGMethod
getMethod()
java.lang.String
getName()
java.lang.Object[]
getParameters()
default java.util.List<ITestNGMethod>
getSkipCausedBy()
long
getStartMillis()
int
getStatus()
IClass
getTestClass()
ITestContext
getTestContext()
java.lang.String
getTestName()
java.lang.Throwable
getThrowable()
java.lang.String
id()
default boolean
isNotRunning()
boolean
isSuccess()
void
setEndMillis(long millis)
void
setParameters(java.lang.Object[] parameters)
void
setStatus(int status)
void
setTestName(java.lang.String name)
void
setThrowable(java.lang.Throwable throwable)
void
setWasRetried(boolean wasRetried)
static boolean
wasFailureDueToTimeout(ITestResult result)
boolean
wasRetried()
-
Methods inherited from interface org.testng.IAttributes
getAttribute, getAttributeNames, removeAttribute, setAttribute
-
-
-
-
Field Detail
-
CREATED
static final int CREATED
- See Also:
- Constant Field Values
-
SUCCESS
static final int SUCCESS
- See Also:
- Constant Field Values
-
FAILURE
static final int FAILURE
- See Also:
- Constant Field Values
-
SKIP
static final int SKIP
- See Also:
- Constant Field Values
-
SUCCESS_PERCENTAGE_FAILURE
static final int SUCCESS_PERCENTAGE_FAILURE
- See Also:
- Constant Field Values
-
STARTED
static final int STARTED
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
java.lang.Object[] getParameters()
- Returns:
- The parameters this method was invoked with.
-
setParameters
void setParameters(java.lang.Object[] parameters)
-
getTestClass
IClass getTestClass()
- Returns:
- The test class used this object is a result for.
-
getThrowable
java.lang.Throwable getThrowable()
- Returns:
- The throwable that was thrown while running the method, or null if no exception was thrown.
-
setThrowable
void setThrowable(java.lang.Throwable throwable)
-
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
java.lang.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
java.lang.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
java.lang.Object getInstance()
- Returns:
- The instance on which this method was run.
-
getFactoryParameters
java.lang.Object[] getFactoryParameters()
- Returns:
- - A parameter array that was passed to a factory method (or) an empty object array otherwise.
-
getTestName
java.lang.String getTestName()
- Returns:
- The test name if this result's related instance implements ITest or use @Test(testName=...), null otherwise.
-
getInstanceName
java.lang.String getInstanceName()
-
getTestContext
ITestContext getTestContext()
- Returns:
- the
ITestContext
for this test result.
-
setTestName
void setTestName(java.lang.String name)
- Parameters:
name
- - The new name to be used as a test name
-
wasRetried
boolean wasRetried()
- Returns:
- -
true
if the test was retried again by an implementation ofIRetryAnalyzer
-
setWasRetried
void setWasRetried(boolean wasRetried)
- Parameters:
wasRetried
- -true
if the test was retried andfalse
otherwise.
-
getSkipCausedBy
default java.util.List<ITestNGMethod> 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
java.lang.String id()
- Returns:
- - A unique id for the current JVM that represents a unique way of identifying a specific test method's result.
-
isNotRunning
default boolean isNotRunning()
-
finalStatuses
static java.util.List<java.lang.String> finalStatuses()
- Returns:
- - A list of all user facing statuses viz.,
-
wasFailureDueToTimeout
static boolean wasFailureDueToTimeout(ITestResult result)
- Parameters:
result
- - The test result of a method- Returns:
- -
true
if the test failure was due to a timeout.
-
-