Package hudson.tasks.junit
Class CaseResult
java.lang.Object
hudson.model.AbstractModelObject
hudson.tasks.junit.TestObject
hudson.tasks.test.TestObject
hudson.tasks.test.TestResult
hudson.tasks.junit.CaseResult
- All Implemented Interfaces:
ModelObject,SearchableModelObject,SearchItem,Serializable,Comparable<CaseResult>
One test result.
Non-final since 1.526
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumConstants that represent the status of this test. -
Constructor Summary
ConstructorsConstructorDescriptionCaseResult(CaseResult src) CaseResult(SuiteResult parent, String testName, String errorStackTrace) Used to create a fake failure, when Hudson fails to load data from XML files.CaseResult(SuiteResult parent, String testName, String errorStackTrace, String errorDetails) CaseResult(SuiteResult parent, String className, String testName, String errorDetails, String skippedMessage, float duration, String stdout, String stderr, String stacktrace) -
Method Summary
Modifier and TypeMethodDescriptionstatic floatclampDuration(float d) intcompareTo(CaseResult that) booleanCase results have no childrenvoidfreeze(SuiteResult parent) intgetAge()Gets the number of consecutive builds (including this) that this test case has been failing.Gets the class name of a test class.Gets the condition for a test result, e.g., has the test regressed since it last ranfloatGets the duration of the test, in secondsIf there was an error or a failure, this is the text from the message.If there was an error or a failure, this is the stack trace, or otherwise null.intGets the total number of failed tests.intIf this test failed, then return the build number when this test started failing.Run<?, ?> If this test failed, then return the run when this test started failing.Collection<? extends TestResult> Gets the "children" of this test result that failedGets the full name of this object.getName()Gets the name of the test, which is returned fromTestCase.getName()Gets the package name of a test case.Reverse pointer ofTabulatedResult.getChildren().intGets the total number of passed tests.Collection<? extends TestResult> Gets the "children" of this test result that passedGets the counter part of thisTestResultin the previous run.Run<?, ?> getRun()Gets the version ofgetName()that's URL-safe.Gets the simple (not qualified) class name.intGets the total number of skipped tests.Provides the reason given for the test being being skipped.Collection<? extends TestResult> Gets the "children" of this test result that were skippedlongGets the start time of the test, in epoch millisecondsThe stderr of this test.The stdout of this test.getTitle()Gets the human readable title of this result object.inthashCode()booleanisFailed()booleanisPassed()booleanTests whether the test was skipped or not.static FailureparseFailure(XMLStreamReader reader, String context) voidsetClass(ClassResult classResult) voidsetParentSuiteResult(SuiteResult parent) voidsetStartTime(long start) Methods inherited from class hudson.tasks.test.TestResult
annotate, getBuildResult, getParentAction, getResultInRun, setParent, setParentAction, tally, toPrettyStringMethods inherited from class hudson.tasks.test.TestObject
doSubmitDescription, getApi, getDescription, getDurationString, getDynamic, getHistory, getId, getRelativePathFrom, getResultInBuild, getSearchUrl, getTestAction, getTestActions, getTestResult, getTestResultAction, getTopLevelTestResult, getTotalCount, getUrl, safe, setDescription, uniquifyNameMethods inherited from class hudson.tasks.junit.TestObject
getOwnerMethods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError, sendError, sendError, sendErrorMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.search.SearchItem
getSearchGroup, getSearchIcon
-
Constructor Details
-
CaseResult
Used to create a fake failure, when Hudson fails to load data from XML files. Public since 1.526.- Parameters:
parent- Parent result.testName- Test name.errorStackTrace- Error stack trace.
-
CaseResult
-
CaseResult
-
CaseResult
-
-
Method Details
-
clampDuration
public static float clampDuration(float d) -
parseFailure
public static Failure parseFailure(XMLStreamReader reader, String context) throws XMLStreamException - Throws:
XMLStreamException
-
getParent
Description copied from class:TestObjectReverse pointer ofTabulatedResult.getChildren().- Specified by:
getParentin classTestObject- Returns:
- the parent
TestObject.
-
getTransformedTestName
-
getDisplayName
- Specified by:
getDisplayNamein interfaceModelObject
-
getName
Gets the name of the test, which is returned fromTestCase.getName()Note that this may contain any URL-unfriendly character.
- Overrides:
getNamein classTestObject- Returns:
- the name of this object.
-
getTitle
Gets the human readable title of this result object.- Overrides:
getTitlein classTestResult- Returns:
- the human readable title of this result object.
-
getDuration
@Exported(visibility=9) public float getDuration()Gets the duration of the test, in seconds- Overrides:
getDurationin classTestResult- Returns:
- the time in seconds the test ran.
-
getStartTime
public long getStartTime()Gets the start time of the test, in epoch milliseconds -
getSafeName
Gets the version ofgetName()that's URL-safe.- Overrides:
getSafeNamein classTestObject- Returns:
- the URL-safe name of this object.
-
getClassName
Gets the class name of a test class.- Returns:
- the class name of a test class.
-
getSimpleName
Gets the simple (not qualified) class name.- Returns:
- the simple (not qualified) class name.
-
getPackageName
Gets the package name of a test case.- Returns:
- the package name of a test case.
-
getFullName
Description copied from class:TestObjectGets the full name of this object.- Overrides:
getFullNamein classTestObject- Returns:
- the full name of this object.
-
getFullDisplayName
- Overrides:
getFullDisplayNamein classTestObject- Since:
- 1.515
-
getTransformedFullDisplayName
-
getFailCount
public int getFailCount()Description copied from class:TestResultGets the total number of failed tests.- Overrides:
getFailCountin classTestResult- Returns:
- the total number of failed tests.
-
getSkipCount
public int getSkipCount()Description copied from class:TestResultGets the total number of skipped tests.- Overrides:
getSkipCountin classTestResult- Returns:
- the total number of skipped tests.
-
getPassCount
public int getPassCount()Description copied from class:TestResultGets the total number of passed tests.- Overrides:
getPassCountin classTestResult- Returns:
- the total number of passed tests.
-
getFailedSince
@Exported(visibility=9) public int getFailedSince()If this test failed, then return the build number when this test started failing.- Overrides:
getFailedSincein classTestResult- Returns:
- the build number when this test started failing.
-
getFailedSinceRun
Description copied from class:TestResultIf this test failed, then return the run when this test started failing.- Overrides:
getFailedSinceRunin classTestResult- Returns:
- the run when this test started failing.
-
getAge
@Exported(visibility=9) public int getAge()Gets the number of consecutive builds (including this) that this test case has been failing.- Returns:
- the number of consecutive failing builds.
-
getStdout
The stdout of this test.Depending on the tool that produced the XML report, this method works somewhat inconsistently. With some tools (such as Maven surefire plugin), you get the accurate information, that is the stdout from this test case. With some other tools (such as the JUnit task in Ant), this method returns the stdout produced by the entire test suite.
If you need to know which is the case, compare this output from
SuiteResult.getStdout().- Overrides:
getStdoutin classTestResult- Returns:
- the stdout of this test.
- Since:
- 1.294
-
getStderr
The stderr of this test.- Overrides:
getStderrin classTestResult- Returns:
- the stderr of this test.
- Since:
- 1.294
- See Also:
-
getPreviousResult
Description copied from class:TestResultGets the counter part of thisTestResultin the previous run.- Overrides:
getPreviousResultin classTestResult- Returns:
- null if no such counter part exists.
-
findCorrespondingResult
Case results have no children- Specified by:
findCorrespondingResultin classTestObject- Parameters:
id- The path to the original test result- Returns:
- null
-
getFailedTests
Gets the "children" of this test result that failed- Overrides:
getFailedTestsin classTestResult- Returns:
- the children of this test result, if any, or an empty collection
-
getPassedTests
Gets the "children" of this test result that passed- Overrides:
getPassedTestsin classTestResult- Returns:
- the children of this test result, if any, or an empty collection
-
getSkippedTests
Gets the "children" of this test result that were skipped- Overrides:
getSkippedTestsin classTestResult- Returns:
- the children of this test result, if any, or an empty list
-
getErrorStackTrace
If there was an error or a failure, this is the stack trace, or otherwise null.- Overrides:
getErrorStackTracein classTestResult- Returns:
- the stack trace of the error or failure.
-
getErrorDetails
If there was an error or a failure, this is the text from the message.- Overrides:
getErrorDetailsin classTestResult- Returns:
- the message of the error or failure.
-
getProperties
- Overrides:
getPropertiesin classTestResult
-
isPassed
public boolean isPassed()- Overrides:
isPassedin classTestResult- Returns:
- true if the test was not skipped and did not fail, false otherwise.
-
isSkipped
@Exported(visibility=9) public boolean isSkipped()Tests whether the test was skipped or not. TestNG allows tests to be skipped if their dependencies fail or they are part of a group that has been configured to be skipped.- Returns:
- true if the test was not executed, false otherwise.
-
isFailed
public boolean isFailed()- Returns:
- true if the test was not skipped and did not pass, false otherwise.
- Since:
- 1.520
-
getSkippedMessage
Provides the reason given for the test being being skipped.- Returns:
- the message given for a skipped test if one has been provided, null otherwise.
- Since:
- 1.507
-
getSuiteResult
-
getFlowNodeId
-
getEnclosingFlowNodeIds
-
getEnclosingFlowNodeNames
-
getRun
- Overrides:
getRunin classTestObject- Returns:
- the run in which this test was executed.
-
setParentSuiteResult
-
freeze
-
compareTo
- Specified by:
compareToin interfaceComparable<CaseResult>
-
equals
-
hashCode
public int hashCode() -
getStatus
-
getCondition
Gets the condition for a test result, e.g., has the test regressed since it last ran -
setClass
-
setStartTime
public void setStartTime(long start) -
getFlakyFailures
- Overrides:
getFlakyFailuresin classTestResult
-
getRerunFailures
- Overrides:
getRerunFailuresin classTestResult
-
getIconFileName
-