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, waitwasFailureDueToTimeoutprivate 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 ITestResultpublic java.lang.String getTestName()
getTestName in interface ITestResultpublic java.lang.String getName()
getName in interface ITestResultpublic ITestNGMethod getMethod()
getMethod in interface ITestResultpublic void setMethod(ITestNGMethod method)
method - The method to set.public int getStatus()
getStatus in interface ITestResultpublic void setStatus(int status)
setStatus in interface ITestResultstatus - The status to set.public boolean isSuccess()
isSuccess in interface ITestResultpublic IClass getTestClass()
getTestClass in interface ITestResultpublic java.lang.Throwable getThrowable()
getThrowable in interface ITestResultpublic void setThrowable(java.lang.Throwable throwable)
setThrowable in interface ITestResultthrowable - The throwable to set.public long getEndMillis()
getEndMillis in interface ITestResultpublic long getStartMillis()
getStartMillis in interface ITestResultpublic java.lang.String toString()
toString in class java.lang.Objectprivate static java.lang.String toString(int status)
public java.lang.String getHost()
getHost in interface ITestResultpublic void setHost(java.lang.String host)
public java.lang.Object[] getParameters()
getParameters in interface ITestResultpublic void setParameters(java.lang.Object[] parameters)
setParameters in interface ITestResultpublic java.lang.Object getInstance()
ITestResultgetInstance in interface ITestResultpublic java.lang.Object[] getFactoryParameters()
getFactoryParameters in interface ITestResultpublic java.lang.Object getAttribute(java.lang.String name)
getAttribute in interface IAttributesname - The name of the attribute to returnpublic void setAttribute(java.lang.String name,
java.lang.Object value)
IAttributessetAttribute in interface IAttributespublic java.util.Set<java.lang.String> getAttributeNames()
getAttributeNames in interface IAttributespublic java.lang.Object removeAttribute(java.lang.String name)
IAttributesremoveAttribute in interface IAttributespublic ITestContext getTestContext()
getTestContext in interface ITestResultITestContext 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 ITestResultpublic void setTestName(java.lang.String name)
setTestName in interface ITestResultname - - The new name to be used as a test namevoid setParameterIndex(int parameterIndex)
public int getParameterIndex()
public boolean wasRetried()
wasRetried in interface ITestResulttrue if the test was retried again by an implementation of IRetryAnalyzerpublic void setWasRetried(boolean wasRetried)
setWasRetried in interface ITestResultwasRetried - - true if the test was retried and false otherwise.public java.util.List<ITestNGMethod> getSkipCausedBy()
getSkipCausedBy in interface ITestResultprivate static boolean isGlobalFailure(ITestResult result)
private boolean isRelated(ITestResult result)
private boolean belongToSameGroup(ITestResult result)
static void copyAttributes(ITestResult source, ITestResult target)