Class TestResult
java.lang.Object
org.testng.internal.TestResult
- All Implemented Interfaces:
Comparable<ITestResult>, IAttributes, ITestResult
This class represents the result of a test.
-
Field Summary
Fields inherited from interface ITestResult
CREATED, FAILURE, SKIP, STARTED, SUCCESS, SUCCESS_PERCENTAGE_FAILURE -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(ITestResult comparison) static voidcopyAttributes(ITestResult source, ITestResult target) getAttribute(String name) longObject[]getHost()getName()intObject[]longintIf this result's related instance implements ITest or use @Test(testName=...), returns its test name, otherwise returns null.id()booleanstatic TestResultnewContextAwareTestResult(ITestNGMethod method, ITestContext ctx) static TestResultstatic TestResultnewEndTimeAwareTestResult(ITestNGMethod method, ITestContext ctx, Throwable t, long start) static TestResultnewTestResultFor(ITestNGMethod method) static TestResultnewTestResultFrom(TestResult result, ITestNGMethod method, ITestContext ctx, long start) static TestResultnewTestResultWithCauseAs(ITestNGMethod method, ITestContext ctx, Throwable t) removeAttribute(String name) Remove the attributevoidsetAttribute(String name, Object value) Set a custom attribute.voidsetContext(ITestContext context) voidsetEndMillis(long millis) voidvoidsetMethod(ITestNGMethod method) voidsetParameterIndex(int parameterIndex) voidsetParameters(Object[] parameters) voidsetStatus(int status) voidsetTestName(String name) voidsetThrowable(Throwable throwable) voidsetWasRetried(boolean wasRetried) toString()booleanMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ITestResult
isNotRunning
-
Method Details
-
newEmptyTestResult
-
newTestResultFor
-
newContextAwareTestResult
-
newTestResultWithCauseAs
public static TestResult newTestResultWithCauseAs(ITestNGMethod method, ITestContext ctx, Throwable t) -
newEndTimeAwareTestResult
public static TestResult newEndTimeAwareTestResult(ITestNGMethod method, ITestContext ctx, Throwable t, long start) -
newTestResultFrom
public static TestResult newTestResultFrom(TestResult result, ITestNGMethod method, ITestContext ctx, long start) -
setEndMillis
public void setEndMillis(long millis) - Specified by:
setEndMillisin interfaceITestResult
-
getTestName
If this result's related instance implements ITest or use @Test(testName=...), returns its test name, otherwise returns null.- Specified by:
getTestNamein interfaceITestResult- Returns:
- The test name if this result's related instance implements ITest or use @Test(testName=...), null otherwise.
-
getName
- Specified by:
getNamein interfaceITestResult- Returns:
- The name of this TestResult, typically identical to the name of the method.
-
getMethod
- Specified by:
getMethodin interfaceITestResult- Returns:
- Returns the method.
-
setMethod
- Parameters:
method- The method to set.
-
getStatus
public int getStatus()- Specified by:
getStatusin interfaceITestResult- Returns:
- Returns the status.
-
setStatus
public void setStatus(int status) - Specified by:
setStatusin interfaceITestResult- Parameters:
status- The status to set.
-
isSuccess
public boolean isSuccess()- Specified by:
isSuccessin interfaceITestResult- Returns:
- true if if this test run is a SUCCESS
-
getTestClass
- Specified by:
getTestClassin interfaceITestResult- Returns:
- Returns the testClass.
-
getThrowable
- Specified by:
getThrowablein interfaceITestResult- Returns:
- Returns the throwable.
-
setThrowable
- Specified by:
setThrowablein interfaceITestResult- Parameters:
throwable- The throwable to set.
-
getEndMillis
public long getEndMillis()- Specified by:
getEndMillisin interfaceITestResult- Returns:
- Returns the endMillis.
-
getStartMillis
public long getStartMillis()- Specified by:
getStartMillisin interfaceITestResult- Returns:
- Returns the startMillis.
-
toString
-
getHost
- Specified by:
getHostin interfaceITestResult- Returns:
- The host where this suite was run, or null if it was run locally. The returned string has the form: host:port
-
setHost
-
getParameters
- Specified by:
getParametersin interfaceITestResult- Returns:
- The parameters this method was invoked with.
-
setParameters
- Specified by:
setParametersin interfaceITestResult
-
getInstance
- Specified by:
getInstancein interfaceITestResult- Returns:
- The instance on which this method was run.
-
getFactoryParameters
- Specified by:
getFactoryParametersin interfaceITestResult- Returns:
- - A parameter array that was passed to a factory method (or) an empty object array otherwise.
-
getAttribute
- Specified by:
getAttributein interfaceIAttributes- Parameters:
name- The name of the attribute to return- Returns:
- The attribute
-
setAttribute
Description copied from interface:IAttributesSet a custom attribute.- Specified by:
setAttributein interfaceIAttributes- Parameters:
name- The attribute namevalue- The attribute value
-
getAttributeNames
- Specified by:
getAttributeNamesin interfaceIAttributes- Returns:
- all the attributes names.
-
removeAttribute
Description copied from interface:IAttributesRemove the attribute- Specified by:
removeAttributein interfaceIAttributes- Parameters:
name- The attribute name- Returns:
- the attribute value if found, null otherwise
-
getTestContext
- Specified by:
getTestContextin interfaceITestResult- Returns:
- the
ITestContextfor this test result.
-
setContext
-
compareTo
- Specified by:
compareToin interfaceComparable<ITestResult>
-
getInstanceName
- Specified by:
getInstanceNamein interfaceITestResult
-
setTestName
- Specified by:
setTestNamein interfaceITestResult- Parameters:
name- - The new name to be used as a test name
-
setParameterIndex
public void setParameterIndex(int parameterIndex) -
getParameterIndex
public int getParameterIndex() -
wasRetried
public boolean wasRetried()- Specified by:
wasRetriedin interfaceITestResult- Returns:
- -
trueif the test was retried again by an implementation ofIRetryAnalyzer
-
setWasRetried
public void setWasRetried(boolean wasRetried) - Specified by:
setWasRetriedin interfaceITestResult- Parameters:
wasRetried- -trueif the test was retried andfalseotherwise.
-
getSkipCausedBy
- Specified by:
getSkipCausedByin interfaceITestResult- 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
- Specified by:
idin interfaceITestResult- Returns:
- - A unique id for the current JVM that represents a unique way of identifying a specific test method's result.
-
copyAttributes
-