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
Modifier and TypeClassDescriptionstatic enum
Constants that represent the status of this test. -
Constructor Summary
ConstructorDescriptionCaseResult
(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 float
clampDuration
(float d) int
compareTo
(CaseResult that) boolean
Case results have no childrenvoid
freeze
(SuiteResult parent) int
getAge()
Gets the number of consecutive builds (including this) that this test case has been failing.Gets the class name of a test class.float
Gets 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.int
Gets the total number of failed tests.int
If 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()
.int
Gets the total number of passed tests.Collection<? extends TestResult>
Gets the "children" of this test result that passedGets the counter part of thisTestResult
in the previous run.Run<?,
?> getRun()
Gets the version ofgetName()
that's URL-safe.Gets the simple (not qualified) class name.int
Gets 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 skippedlong
Gets 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.int
hashCode()
boolean
isFailed()
boolean
isPassed()
boolean
Tests whether the test was skipped or not.void
setClass
(ClassResult classResult) void
setParentSuiteResult
(SuiteResult parent) void
setStartTime
(long start) Methods inherited from class hudson.tasks.test.TestResult
annotate, getBuildResult, getParentAction, getResultInRun, setParent, setParentAction, tally, toPrettyString
Methods 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, uniquifyName
Methods inherited from class hudson.tasks.junit.TestObject
getOwner
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
-
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) -
getParent
Description copied from class:TestObject
Reverse pointer ofTabulatedResult.getChildren()
.- Specified by:
getParent
in classTestObject
- Returns:
- the parent
TestObject
.
-
getTransformedTestName
-
getDisplayName
- Specified by:
getDisplayName
in interfaceModelObject
-
getName
Gets the name of the test, which is returned fromTestCase.getName()
Note that this may contain any URL-unfriendly character.
- Overrides:
getName
in classTestObject
- Returns:
- the name of this object.
-
getTitle
Gets the human readable title of this result object.- Overrides:
getTitle
in 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:
getDuration
in 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:
getSafeName
in 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:TestObject
Gets the full name of this object.- Overrides:
getFullName
in classTestObject
- Returns:
- the full name of this object.
-
getFullDisplayName
- Overrides:
getFullDisplayName
in classTestObject
- Since:
- 1.515
-
getTransformedFullDisplayName
-
getFailCount
public int getFailCount()Description copied from class:TestResult
Gets the total number of failed tests.- Overrides:
getFailCount
in classTestResult
- Returns:
- the total number of failed tests.
-
getSkipCount
public int getSkipCount()Description copied from class:TestResult
Gets the total number of skipped tests.- Overrides:
getSkipCount
in classTestResult
- Returns:
- the total number of skipped tests.
-
getPassCount
public int getPassCount()Description copied from class:TestResult
Gets the total number of passed tests.- Overrides:
getPassCount
in 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:
getFailedSince
in classTestResult
- Returns:
- the build number when this test started failing.
-
getFailedSinceRun
Description copied from class:TestResult
If this test failed, then return the run when this test started failing.- Overrides:
getFailedSinceRun
in 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:
getStdout
in classTestResult
- Returns:
- the stdout of this test.
- Since:
- 1.294
-
getStderr
The stderr of this test.- Overrides:
getStderr
in classTestResult
- Returns:
- the stderr of this test.
- Since:
- 1.294
- See Also:
-
getPreviousResult
Description copied from class:TestResult
Gets the counter part of thisTestResult
in the previous run.- Overrides:
getPreviousResult
in classTestResult
- Returns:
- null if no such counter part exists.
-
findCorrespondingResult
Case results have no children- Specified by:
findCorrespondingResult
in classTestObject
- Parameters:
id
- The path to the original test result- Returns:
- null
-
getFailedTests
Gets the "children" of this test result that failed- Overrides:
getFailedTests
in 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:
getPassedTests
in 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:
getSkippedTests
in 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:
getErrorStackTrace
in 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:
getErrorDetails
in classTestResult
- Returns:
- the message of the error or failure.
-
getProperties
- Overrides:
getProperties
in classTestResult
-
isPassed
public boolean isPassed()- Overrides:
isPassed
in 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:
getRun
in classTestObject
- Returns:
- the run in which this test was executed.
-
setParentSuiteResult
-
freeze
-
compareTo
- Specified by:
compareTo
in interfaceComparable<CaseResult>
-
equals
-
hashCode
public int hashCode() -
getStatus
-
setClass
-
setStartTime
public void setStartTime(long start)
-