Package hudson.tasks.test
Class SimpleCaseResult
- java.lang.Object
-
- hudson.model.AbstractModelObject
-
- hudson.tasks.junit.TestObject
-
- hudson.tasks.test.TestObject
-
- hudson.tasks.test.TestResult
-
- hudson.tasks.test.SimpleCaseResult
-
- All Implemented Interfaces:
ModelObject
,SearchableModelObject
,SearchItem
,Serializable
public class SimpleCaseResult extends TestResult
The simplest possible case result, with no language ties. Acts as if it passed, has no children, and has no failed or skipped tests.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected float
duration
static List<TestAction>
EMPTY_ACTION_LIST
An empty list of actions, useful for testsprotected List<SimpleCaseResult>
listOnlyContainingThisObject
protected AbstractTestResultAction
parentAction
-
Constructor Summary
Constructors Constructor Description SimpleCaseResult()
SimpleCaseResult(float duration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TestResult
findCorrespondingResult(String id)
Find the test result corresponding to the one identified byid
within this test result.String
getDisplayName()
float
getDuration()
Time took to run this test.int
getFailCount()
Gets the total number of failed tests.Collection<? extends TestResult>
getFailedTests()
Gets the "children" of this test result that failedString
getName()
Gets the name of this object.TestObject
getParent()
Reverse pointer ofTabulatedResult.getChildren()
.AbstractTestResultAction
getParentAction()
Returns the action that points to the top level test result includes this test result.int
getPassCount()
Gets the total number of passed tests.Collection<? extends TestResult>
getPassedTests()
Gets the "children" of this test result that passedRun<?,?>
getRun()
int
getSkipCount()
Gets the total number of skipped tests.Collection<? extends TestResult>
getSkippedTests()
Gets the "children" of this test result that were skippedList<TestAction>
getTestActions()
Get a list of all TestActions associated with this TestObject.String
getTitle()
Gets the human readable title of this result object.boolean
isFailed()
Returns true iff this test failed.boolean
isPassed()
Let's pretend that our trivial test result always passes.boolean
isSkipped()
Tests whether the test was skipped or not.void
setParentAction(AbstractTestResultAction parentAction)
Sets the parent action, which means the action that binds this particular case result to a build.-
Methods inherited from class hudson.tasks.test.TestResult
annotate, getBuildResult, getErrorDetails, getErrorStackTrace, getFailedSince, getFailedSinceRun, getPreviousResult, getProperties, getResultInRun, getStderr, getStdout, setParent, tally, toPrettyString
-
Methods inherited from class hudson.tasks.test.TestObject
doSubmitDescription, getApi, getDescription, getDurationString, getDynamic, getFullDisplayName, getFullName, getHistory, getId, getRelativePathFrom, getResultInBuild, getSafeName, getSearchUrl, getTestAction, 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
-
-
-
-
Field Detail
-
parentAction
protected AbstractTestResultAction parentAction
-
listOnlyContainingThisObject
protected final List<SimpleCaseResult> listOnlyContainingThisObject
-
duration
protected float duration
-
EMPTY_ACTION_LIST
public static final List<TestAction> EMPTY_ACTION_LIST
An empty list of actions, useful for tests
-
-
Method Detail
-
setParentAction
public void setParentAction(AbstractTestResultAction parentAction)
Sets the parent action, which means the action that binds this particular case result to a build. Should not be null.- Overrides:
setParentAction
in classTestResult
- Parameters:
parentAction
-
-
getParentAction
public AbstractTestResultAction getParentAction()
Description copied from class:TestResult
Returns the action that points to the top level test result includes this test result.- Overrides:
getParentAction
in classTestResult
- Returns:
- action The action that points to the top level test result.
-
getParent
public TestObject getParent()
Description copied from class:TestObject
Reverse pointer ofTabulatedResult.getChildren()
.- Specified by:
getParent
in classTestObject
- Returns:
- the parent
TestObject
.
-
findCorrespondingResult
public TestResult findCorrespondingResult(String id)
Description copied from class:TestObject
Find the test result corresponding to the one identified byid
within this test result.- Specified by:
findCorrespondingResult
in classTestObject
- Parameters:
id
- The path to the original test result- Returns:
- A corresponding test result, or null if there is no corresponding result.
-
getFailedTests
public Collection<? extends TestResult> 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
public Collection<? extends TestResult> 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
public Collection<? extends TestResult> 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
-
isPassed
public boolean isPassed()
Let's pretend that our trivial test result always passes.- Overrides:
isPassed
in classTestResult
- Returns:
- always true
-
isSkipped
public boolean isSkipped()
Tests whether the test was skipped or not.- Returns:
- true if the test was not executed, false otherwise.
-
isFailed
public boolean isFailed()
Returns true iff this test failed.
-
getDuration
public float getDuration()
Time took to run this test. In seconds.- Overrides:
getDuration
in classTestResult
- Returns:
- the time in seconds the test ran.
-
getName
public String getName()
Gets the name of this object.- Overrides:
getName
in classTestObject
- Returns:
- the name of this object.
-
getPassCount
public int getPassCount()
Gets the total number of passed tests.- Overrides:
getPassCount
in classTestResult
- Returns:
- the total number of passed tests.
-
getFailCount
public int getFailCount()
Gets the total number of failed tests.- Overrides:
getFailCount
in classTestResult
- Returns:
- the total number of failed tests.
-
getSkipCount
public int getSkipCount()
Gets the total number of skipped tests.- Overrides:
getSkipCount
in classTestResult
- Returns:
- the total number of skipped tests.
-
getTitle
public String getTitle()
Gets the human readable title of this result object.- Overrides:
getTitle
in classTestResult
- Returns:
- the human readable title of this result object.
-
getDisplayName
public String getDisplayName()
-
getRun
public Run<?,?> getRun()
- Overrides:
getRun
in classTestObject
- Returns:
- the run in which this test was executed.
-
getTestActions
public List<TestAction> getTestActions()
Description copied from class:TestObject
Get a list of all TestActions associated with this TestObject.- Overrides:
getTestActions
in classTestObject
-
-