Top Description Fields Methods
org.testng

public Interface ITestResult

extends IAttributes, Comparable<ITestResult>
Known Direct Implementers
org.testng.internal.TestResult
Imports
java.util.Arrays, .Collections, .List, org.testng.internal.thread.ThreadTimeoutException

This class describes the result of a test.
Author
Cedric Beust, May 2, 2004
Since
May 2, 2004
Version
$Revision: 721 $, $Date: 2009-05-23 09:55:46 -0700 (Sat, 23 May 2009) $

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int

Method Summary

Modifier and TypeMethod and Description
public static List<String>
public long

Returns:

the end date for this test, in milliseconds.
getEndMillis
()

public Object[]

Returns:

- A parameter array that was passed to a factory method (or) an empty object array otherwise.
getFactoryParameters
()

public String

Returns:

The host where this suite was run, or null if it was run locally. The returned string has the form: host:port
getHost
()

public Object

Returns:

The instance on which this method was run.
getInstance
()

public String
public ITestNGMethod

Returns:

The test method this result represents.
getMethod
()

public String

Returns:

The name of this TestResult, typically identical to the name of the method.
getName
()

public Object[]

Returns:

The parameters this method was invoked with.
getParameters
()

public default List<ITestNGMethod>

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.
getSkipCausedBy
()

public long

Returns:

the start date for this test, in milliseconds.
getStartMillis
()

public int

Returns:

The status of this result, using one of the constants above.
getStatus
()

public IClass

Returns:

The test class used this object is a result for.
getTestClass
()

public ITestContext

Returns:

the ITestContext for this test result.
getTestContext
()

public String

Returns:

The test name if this result's related instance implements ITest or use @Test(testName=...), null otherwise.
getTestName
()

public Throwable

Returns:

The throwable that was thrown while running the method, or null if no exception was thrown.
getThrowable
()

public String

Returns:

- A unique id for the current JVM that represents a unique way of identifying a specific test method's result.
id
()

public default boolean

Returns:

- true if the current test result is either ITestResult#STARTED or ITestResult#CREATED
isNotRunning
()

public boolean

Returns:

true if if this test run is a SUCCESS
isSuccess
()

public void
setEndMillis(long millis)

public void
setParameters(Object[] parameters)

public void
setStatus(int status)

public void
setTestName(String
- The new name to be used as a test name
name
)

public void
public void
setWasRetried(boolean
- true if the test was retried and false otherwise.
wasRetried
)

public static boolean

Returns:

- true if the test failure was due to a timeout.
wasFailureDueToTimeout
(ITestResult
- The test result of a method
result
)

public boolean

Returns:

- true if the test was retried again by an implementation of IRetryAnalyzer
wasRetried
()

Inherited from java.lang.Comparable:
compareTo
Inherited from org.testng.IAttributes:
getAttributegetAttributeNamesremoveAttributesetAttribute

Field Detail

CREATEDback to summary
public static final int CREATED
FAILUREback to summary
public static final int FAILURE
SKIPback to summary
public static final int SKIP
STARTEDback to summary
public static final int STARTED
SUCCESSback to summary
public static final int SUCCESS
SUCCESS_PERCENTAGE_FAILUREback to summary
public static final int SUCCESS_PERCENTAGE_FAILURE

Method Detail

finalStatusesback to summary
public static List<String> finalStatuses()
Returns:List<String>

- A list of all user facing statuses viz.,

getEndMillisback to summary
public long getEndMillis()
Returns:long

the end date for this test, in milliseconds.

getFactoryParametersback to summary
public Object[] getFactoryParameters()
Returns:Object[]

- A parameter array that was passed to a factory method (or) an empty object array otherwise.

getHostback to summary
public String getHost()
Returns:String

The host where this suite was run, or null if it was run locally. The returned string has the form: host:port

getInstanceback to summary
public Object getInstance()
Returns:Object

The instance on which this method was run.

getInstanceNameback to summary
public String getInstanceName()
getMethodback to summary
public ITestNGMethod getMethod()
Returns:ITestNGMethod

The test method this result represents.

getNameback to summary
public String getName()
Returns:String

The name of this TestResult, typically identical to the name of the method.

getParametersback to summary
public Object[] getParameters()
Returns:Object[]

The parameters this method was invoked with.

getSkipCausedByback to summary
public default List<ITestNGMethod> getSkipCausedBy()
Returns:List<ITestNGMethod>

- 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.

getStartMillisback to summary
public long getStartMillis()
Returns:long

the start date for this test, in milliseconds.

getStatusback to summary
public int getStatus()
Returns:int

The status of this result, using one of the constants above.

getTestClassback to summary
public IClass getTestClass()
Returns:IClass

The test class used this object is a result for.

getTestContextback to summary
public ITestContext getTestContext()
Returns:ITestContext

the ITestContext for this test result.

getTestNameback to summary
public String getTestName()
Returns:String

The test name if this result's related instance implements ITest or use @Test(testName=...), null otherwise.

getThrowableback to summary
public Throwable getThrowable()
Returns:Throwable

The throwable that was thrown while running the method, or null if no exception was thrown.

idback to summary
public String id()
Returns:String

- A unique id for the current JVM that represents a unique way of identifying a specific test method's result.

isNotRunningback to summary
public default boolean isNotRunning()
Returns:boolean

- true if the current test result is either ITestResult#STARTED or ITestResult#CREATED

isSuccessback to summary
public boolean isSuccess()
Returns:boolean

true if if this test run is a SUCCESS

setEndMillisback to summary
public void setEndMillis(long millis)
setParametersback to summary
public void setParameters(Object[] parameters)
setStatusback to summary
public void setStatus(int status)
setTestNameback to summary
public void setTestName(String name)
Parameters
name:String

- The new name to be used as a test name

setThrowableback to summary
public void setThrowable(Throwable throwable)
setWasRetriedback to summary
public void setWasRetried(boolean wasRetried)
Parameters
wasRetried:boolean

- true if the test was retried and false otherwise.

wasFailureDueToTimeoutback to summary
public static boolean wasFailureDueToTimeout(ITestResult result)
Parameters
result:ITestResult

- The test result of a method

Returns:boolean

- true if the test failure was due to a timeout.

wasRetriedback to summary
public boolean wasRetried()
Returns:boolean

- true if the test was retried again by an implementation of IRetryAnalyzer