Package hudson.tasks.test
Class TestResult
java.lang.Object
hudson.model.AbstractModelObject
hudson.tasks.junit.TestObject
hudson.tasks.test.TestObject
hudson.tasks.test.TestResult
- All Implemented Interfaces:
ModelObject,SearchableModelObject,SearchItem,Serializable
- Direct Known Subclasses:
CaseResult,SimpleCaseResult,TabulatedResult
A class that represents a general concept of a test result, without any
language or implementation specifics.
Subclasses must add @Exported annotation to the fields they want to export.
- Since:
- 1.343
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAnnotate some text -- what does this do?Mark a build as unstable if there are failures.floatTime it took to run this test.If 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 failedReturns the action that points to the top level test result includes this test result.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.getResultInRun(Run<?, ?> build) Gets the counter part of thisTestResultin the specified run.intGets the total number of skipped tests.Collection<? extends TestResult>Gets the "children" of this test result that were skippedThe stderr of this test.The stdout of this test.getTitle()Gets the human readable title of this result object.booleanisPassed()voidsetParent(TestObject parent) Sets the parent test resultvoidIf the concept of a parent action is important to a subclass, then it should provide a non-noop implementation of this method.voidtally()Request that the result update its counts of its children.Methods inherited from class hudson.tasks.test.TestObject
doSubmitDescription, findCorrespondingResult, getApi, getDescription, getDurationString, getDynamic, getFullDisplayName, getFullName, getHistory, getId, getName, getParent, getRelativePathFrom, getResultInBuild, getSafeName, getSearchUrl, getTestAction, getTestActions, getTestResult, getTestResultAction, getTopLevelTestResult, getTotalCount, getUrl, safe, setDescription, uniquifyNameMethods inherited from class hudson.tasks.junit.TestObject
getOwner, getRunMethods 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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.model.ModelObject
getDisplayNameMethods inherited from interface hudson.search.SearchItem
getSearchGroup, getSearchIcon
-
Constructor Details
-
TestResult
public TestResult()
-
-
Method Details
-
setParentAction
If the concept of a parent action is important to a subclass, then it should provide a non-noop implementation of this method.- Parameters:
action- Action that points to the top level test result.
-
getParentAction
Returns the action that points to the top level test result includes this test result.- Returns:
- action The action that points to the top level test result.
-
tally
public void tally()Request that the result update its counts of its children. Does not require a parent action or owner or siblings. Subclasses should implement this, unless they are *always* in a tallied state. -
setParent
Sets the parent test result- Parameters:
parent- Parent test result.
-
getTitle
Gets the human readable title of this result object.- Returns:
- the human readable title of this result object.
-
getBuildResult
Mark a build as unstable if there are failures. Otherwise, leave the build result unchanged.- Returns:
Result.UNSTABLEif there are test failures, null otherwise.
-
getDuration
public float getDuration()Time it took to run this test. In seconds.- Specified by:
getDurationin classTestObject- Returns:
- the time in seconds the test ran.
-
getPassCount
public int getPassCount()Gets the total number of passed tests.- Specified by:
getPassCountin classTestObject- Returns:
- the total number of passed tests.
-
getFailCount
public int getFailCount()Gets the total number of failed tests.- Specified by:
getFailCountin classTestObject- Returns:
- the total number of failed tests.
-
getSkipCount
public int getSkipCount()Gets the total number of skipped tests.- Specified by:
getSkipCountin classTestObject- Returns:
- the total number of skipped tests.
-
getPreviousResult
Gets the counter part of thisTestResultin the previous run.- Specified by:
getPreviousResultin classTestObject- Returns:
- null if no such counter part exists.
-
getResultInRun
Gets the counter part of thisTestResultin the specified run.- Overrides:
getResultInRunin classTestObject- Parameters:
build- The run for which the run is requested.- Returns:
- null if no such counter part exists.
-
getFailedTests
Gets the "children" of this test result that failed- Returns:
- the children of this test result, if any, or an empty collection
-
getPassedTests
Gets the "children" of this test result that passed- Returns:
- the children of this test result, if any, or an empty collection
-
getSkippedTests
Gets the "children" of this test result that were skipped- Returns:
- the children of this test result, if any, or an empty list
-
getFailedSince
public int getFailedSince()If this test failed, then return the build number when this test started failing.- Returns:
- the build number when this test started failing.
-
getFailedSinceRun
If this test failed, then return the run when this test started failing.- Returns:
- the run when this test started failing.
-
getStdout
The stdout of this test.- Returns:
- the stdout of this test.
-
getStderr
The stderr of this test.- Returns:
- the stderr of this test.
-
getErrorStackTrace
If there was an error or a failure, this is the stack trace, or otherwise null.- 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.- Returns:
- the message of the error or failure.
-
getProperties
-
isPassed
public boolean isPassed()- Returns:
- true if the test was not skipped and did not fail, false otherwise.
-
toPrettyString
-
annotate
Annotate some text -- what does this do?- Parameters:
text- Text to use to annotate the actions.- Returns:
- the provided text HTML-escaped.
-