public class TestResult extends java.lang.Object implements ITestResult
Modifier and Type | Field and Description |
---|---|
private IAttributes |
m_attributes |
private ITestContext |
m_context |
private long |
m_endMillis |
private java.lang.String |
m_host |
private java.lang.String |
m_instanceName |
private ITestNGMethod |
m_method |
private java.lang.String |
m_name |
private java.lang.Object[] |
m_parameters |
private long |
m_startMillis |
private int |
m_status |
private java.lang.Throwable |
m_throwable |
private boolean |
m_wasRetried |
private int |
parameterIndex |
private boolean |
skipAnalysed |
private java.util.List<ITestNGMethod> |
skippedDueTo |
CREATED, FAILURE, SKIP, STARTED, SUCCESS, SUCCESS_PERCENTAGE_FAILURE
Modifier | Constructor and Description |
---|---|
private |
TestResult() |
Modifier and Type | Method and Description |
---|---|
private boolean |
belongToSameGroup(ITestResult result) |
int |
compareTo(ITestResult comparison) |
(package private) static void |
copyAttributes(ITestResult source,
ITestResult target) |
java.lang.Object |
getAttribute(java.lang.String name) |
java.util.Set<java.lang.String> |
getAttributeNames() |
long |
getEndMillis() |
java.lang.Object[] |
getFactoryParameters() |
java.lang.String |
getHost() |
java.lang.Object |
getInstance()
The instance on which this method was run.
|
java.lang.String |
getInstanceName() |
ITestNGMethod |
getMethod() |
java.lang.String |
getName() |
int |
getParameterIndex() |
java.lang.Object[] |
getParameters() |
java.util.List<ITestNGMethod> |
getSkipCausedBy() |
long |
getStartMillis() |
int |
getStatus() |
IClass |
getTestClass() |
ITestContext |
getTestContext() |
java.lang.String |
getTestName()
If this result's related instance implements ITest or use @Test(testName=...), returns its test
name, otherwise returns null.
|
java.lang.Throwable |
getThrowable() |
private void |
init(ITestNGMethod method,
ITestContext ctx,
java.lang.Throwable t,
long start,
long end) |
private static boolean |
isGlobalFailure(ITestResult result) |
private boolean |
isRelated(ITestResult result) |
boolean |
isSuccess() |
static TestResult |
newContextAwareTestResult(ITestNGMethod method,
ITestContext ctx) |
static TestResult |
newEmptyTestResult() |
static TestResult |
newEndTimeAwareTestResult(ITestNGMethod method,
ITestContext ctx,
java.lang.Throwable t,
long start) |
static TestResult |
newTestResultFor(ITestNGMethod method) |
static TestResult |
newTestResultFrom(TestResult result,
ITestNGMethod method,
ITestContext ctx,
long start) |
static TestResult |
newTestResultWithCauseAs(ITestNGMethod method,
ITestContext ctx,
java.lang.Throwable t) |
java.lang.Object |
removeAttribute(java.lang.String name)
Remove the attribute
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Set a custom attribute.
|
void |
setContext(ITestContext context) |
void |
setEndMillis(long millis) |
void |
setHost(java.lang.String host) |
void |
setMethod(ITestNGMethod method) |
(package private) void |
setParameterIndex(int parameterIndex) |
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) |
java.lang.String |
toString() |
private static java.lang.String |
toString(int status) |
boolean |
wasRetried() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
wasFailureDueToTimeout
private ITestNGMethod m_method
private java.util.List<ITestNGMethod> skippedDueTo
private boolean skipAnalysed
private int m_status
private java.lang.Throwable m_throwable
private long m_startMillis
private long m_endMillis
private java.lang.String m_name
private java.lang.String m_host
private java.lang.Object[] m_parameters
private java.lang.String m_instanceName
private ITestContext m_context
private int parameterIndex
private boolean m_wasRetried
private final IAttributes m_attributes
public static TestResult newEmptyTestResult()
public static TestResult newTestResultFor(ITestNGMethod method)
public static TestResult newContextAwareTestResult(ITestNGMethod method, ITestContext ctx)
public static TestResult newTestResultWithCauseAs(ITestNGMethod method, ITestContext ctx, java.lang.Throwable t)
public static TestResult newEndTimeAwareTestResult(ITestNGMethod method, ITestContext ctx, java.lang.Throwable t, long start)
public static TestResult newTestResultFrom(TestResult result, ITestNGMethod method, ITestContext ctx, long start)
private void init(ITestNGMethod method, ITestContext ctx, java.lang.Throwable t, long start, long end)
public void setEndMillis(long millis)
setEndMillis
in interface ITestResult
public java.lang.String getTestName()
getTestName
in interface ITestResult
public java.lang.String getName()
getName
in interface ITestResult
public ITestNGMethod getMethod()
getMethod
in interface ITestResult
public void setMethod(ITestNGMethod method)
method
- The method to set.public int getStatus()
getStatus
in interface ITestResult
public void setStatus(int status)
setStatus
in interface ITestResult
status
- The status to set.public boolean isSuccess()
isSuccess
in interface ITestResult
public IClass getTestClass()
getTestClass
in interface ITestResult
public java.lang.Throwable getThrowable()
getThrowable
in interface ITestResult
public void setThrowable(java.lang.Throwable throwable)
setThrowable
in interface ITestResult
throwable
- The throwable to set.public long getEndMillis()
getEndMillis
in interface ITestResult
public long getStartMillis()
getStartMillis
in interface ITestResult
public java.lang.String toString()
toString
in class java.lang.Object
private static java.lang.String toString(int status)
public java.lang.String getHost()
getHost
in interface ITestResult
public void setHost(java.lang.String host)
public java.lang.Object[] getParameters()
getParameters
in interface ITestResult
public void setParameters(java.lang.Object[] parameters)
setParameters
in interface ITestResult
public java.lang.Object getInstance()
ITestResult
getInstance
in interface ITestResult
public java.lang.Object[] getFactoryParameters()
getFactoryParameters
in interface ITestResult
public java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface IAttributes
name
- The name of the attribute to returnpublic void setAttribute(java.lang.String name, java.lang.Object value)
IAttributes
setAttribute
in interface IAttributes
public java.util.Set<java.lang.String> getAttributeNames()
getAttributeNames
in interface IAttributes
public java.lang.Object removeAttribute(java.lang.String name)
IAttributes
removeAttribute
in interface IAttributes
public ITestContext getTestContext()
getTestContext
in interface ITestResult
ITestContext
for this test result.public void setContext(ITestContext context)
public int compareTo(@Nonnull ITestResult comparison)
compareTo
in interface java.lang.Comparable<ITestResult>
public java.lang.String getInstanceName()
getInstanceName
in interface ITestResult
public void setTestName(java.lang.String name)
setTestName
in interface ITestResult
name
- - The new name to be used as a test namevoid setParameterIndex(int parameterIndex)
public int getParameterIndex()
public boolean wasRetried()
wasRetried
in interface ITestResult
true
if the test was retried again by an implementation of IRetryAnalyzer
public void setWasRetried(boolean wasRetried)
setWasRetried
in interface ITestResult
wasRetried
- - true
if the test was retried and false
otherwise.public java.util.List<ITestNGMethod> getSkipCausedBy()
getSkipCausedBy
in interface ITestResult
private static boolean isGlobalFailure(ITestResult result)
private boolean isRelated(ITestResult result)
private boolean belongToSameGroup(ITestResult result)
static void copyAttributes(ITestResult source, ITestResult target)