Class FlakyCaseResult
java.lang.Object
hudson.model.AbstractModelObject
hudson.tasks.junit.TestObject
hudson.tasks.test.TestObject
hudson.tasks.test.TestResult
com.google.jenkins.flakyTestHandler.junit.FlakyCaseResult
- All Implemented Interfaces:
ActionableFlakyTestObject
,ModelObject
,SearchableModelObject
,SearchItem
,Serializable
,Comparable<FlakyCaseResult>
public class FlakyCaseResult
extends hudson.tasks.test.TestResult
implements Comparable<FlakyCaseResult>, ActionableFlakyTestObject
One test result augmented with flaky information.
Majority of code copied from hudson.tasks.junit.CaseResult
https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/tasks/
junit/CaseResult.java
- Author:
- Qingzhou Luo
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static enum
Constants that represent the status of this test. -
Constructor Summary
ConstructorDescriptionFlakyCaseResult
(FlakySuiteResult parent, String testName, String errorStackTrace) Used to create a fake failure, when Hudson fails to load data from XML files. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(FlakyCaseResult that) boolean
hudson.tasks.test.TestResult
Case results have no childrenvoid
freeze
(FlakySuiteResult parent) 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
Collection<? extends hudson.tasks.test.TestResult>
Gets the "children" of this test result that failedgetName()
Gets the name of the test, which is returned fromTestCase.getName()
AbstractBuild<?,
?> getOwner()
Gets the package name of a test caseint
Collection<? extends hudson.tasks.test.TestResult>
Gets the "children" of this test result that passedGets the version ofgetName()
that's URL-safe.Gets the simple (not qualified) class name.int
Provides the reason given for the test being being skipped.Collection<? extends hudson.tasks.test.TestResult>
Gets the "children" of this test result that were skippedThe stderr of this test.The stdout of this test.hudson.tasks.junit.TestAction
getTitle()
Gets the human readable title of this result object.int
hashCode()
boolean
isFailed()
boolean
isFlaked()
boolean
isPassed()
boolean
Tests whether the test was skipped or not.void
setParentSuiteResult
(FlakySuiteResult parent) Methods inherited from class hudson.tasks.test.TestResult
annotate, getBuildResult, getFailedSince, getFailedSinceRun, getParentAction, getProperties, 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
getRun
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
-
Constructor Details
-
FlakyCaseResult
Used to create a fake failure, when Hudson fails to load data from XML files. Public since 1.526.- Parameters:
parent
- suite resulttestName
- test nameerrorStackTrace
- stack trace
-
-
Method Details
-
getParent
- Specified by:
getParent
in classhudson.tasks.test.TestObject
-
getDisplayName
- Specified by:
getDisplayName
in interfaceModelObject
-
getFlakyRuns
-
getName
Gets the name of the test, which is returned fromTestCase.getName()
Note that this may contain any URL-unfriendly character.
- Overrides:
getName
in classhudson.tasks.test.TestObject
-
getTitle
Gets the human readable title of this result object.- Overrides:
getTitle
in classhudson.tasks.test.TestResult
-
getDuration
@Exported(visibility=9) public float getDuration()Gets the duration of the test, in seconds- Overrides:
getDuration
in classhudson.tasks.test.TestResult
-
getSafeName
Gets the version ofgetName()
that's URL-safe.- Overrides:
getSafeName
in classhudson.tasks.test.TestObject
-
getClassName
Gets the class name of a test class.- Returns:
- class name
-
getSimpleName
Gets the simple (not qualified) class name.- Returns:
- simple class name
-
getPackageName
Gets the package name of a test case- Returns:
- package name
-
getFullName
- Overrides:
getFullName
in classhudson.tasks.test.TestObject
-
getFullDisplayName
- Overrides:
getFullDisplayName
in classhudson.tasks.test.TestObject
- Returns:
- full display name
- Since:
- 1.515
-
getFailCount
public int getFailCount()- Overrides:
getFailCount
in classhudson.tasks.test.TestResult
-
getSkipCount
public int getSkipCount()- Overrides:
getSkipCount
in classhudson.tasks.test.TestResult
-
getPassCount
public int getPassCount()- Overrides:
getPassCount
in classhudson.tasks.test.TestResult
-
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
FlakySuiteResult.getStdout()
.- Overrides:
getStdout
in classhudson.tasks.test.TestResult
- Since:
- 1.294
-
getStderr
The stderr of this test.- Overrides:
getStderr
in classhudson.tasks.test.TestResult
- Since:
- 1.294
- See Also:
-
getPreviousResult
- Overrides:
getPreviousResult
in classhudson.tasks.test.TestResult
-
findCorrespondingResult
Case results have no children- Specified by:
findCorrespondingResult
in classhudson.tasks.test.TestObject
- Returns:
- null
-
getFailedTests
Gets the "children" of this test result that failed- Overrides:
getFailedTests
in classhudson.tasks.test.TestResult
- 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 classhudson.tasks.test.TestResult
- 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 classhudson.tasks.test.TestResult
- 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 classhudson.tasks.test.TestResult
-
getErrorDetails
If there was an error or a failure, this is the text from the message.- Overrides:
getErrorDetails
in classhudson.tasks.test.TestResult
-
isPassed
public boolean isPassed()- Overrides:
isPassed
in classhudson.tasks.test.TestResult
- 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
-
isFlaked
public boolean isFlaked() -
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
-
getOwner
- Overrides:
getOwner
in classhudson.tasks.junit.TestObject
-
setParentSuiteResult
-
freeze
-
compareTo
- Specified by:
compareTo
in interfaceComparable<FlakyCaseResult>
-
equals
-
hashCode
public int hashCode() -
getStatus
-
getTestAction
public hudson.tasks.junit.TestAction getTestAction()- Specified by:
getTestAction
in interfaceActionableFlakyTestObject
-