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
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumConstants that represent the status of this test. -
Constructor Summary
ConstructorsConstructorDescriptionFlakyCaseResult(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 TypeMethodDescriptionintcompareTo(FlakyCaseResult that) booleanhudson.tasks.test.TestResultCase results have no childrenvoidfreeze(FlakySuiteResult parent) Gets the class name of a test class.floatGets 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.intCollection<? 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 caseintCollection<? 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.intProvides 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.TestActiongetTitle()Gets the human readable title of this result object.inthashCode()booleanisFailed()booleanisFlaked()booleanisPassed()booleanTests whether the test was skipped or not.voidsetParentSuiteResult(FlakySuiteResult parent) Methods inherited from class hudson.tasks.test.TestResult
annotate, getBuildResult, getFailedSince, getFailedSinceRun, getParentAction, getProperties, 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
getRunMethods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, 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:
getParentin classhudson.tasks.test.TestObject
-
getDisplayName
- Specified by:
getDisplayNamein interfaceModelObject
-
getFlakyRuns
-
getName
Gets the name of the test, which is returned fromTestCase.getName()Note that this may contain any URL-unfriendly character.
- Overrides:
getNamein classhudson.tasks.test.TestObject
-
getTitle
Gets the human readable title of this result object.- Overrides:
getTitlein classhudson.tasks.test.TestResult
-
getDuration
@Exported(visibility=9) public float getDuration()Gets the duration of the test, in seconds- Overrides:
getDurationin classhudson.tasks.test.TestResult
-
getSafeName
Gets the version ofgetName()that's URL-safe.- Overrides:
getSafeNamein 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:
getFullNamein classhudson.tasks.test.TestObject
-
getFullDisplayName
- Overrides:
getFullDisplayNamein classhudson.tasks.test.TestObject- Returns:
- full display name
- Since:
- 1.515
-
getFailCount
public int getFailCount()- Overrides:
getFailCountin classhudson.tasks.test.TestResult
-
getSkipCount
public int getSkipCount()- Overrides:
getSkipCountin classhudson.tasks.test.TestResult
-
getPassCount
public int getPassCount()- Overrides:
getPassCountin 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:
getStdoutin classhudson.tasks.test.TestResult- Since:
- 1.294
-
getStderr
The stderr of this test.- Overrides:
getStderrin classhudson.tasks.test.TestResult- Since:
- 1.294
- See Also:
-
getPreviousResult
- Overrides:
getPreviousResultin classhudson.tasks.test.TestResult
-
findCorrespondingResult
Case results have no children- Specified by:
findCorrespondingResultin classhudson.tasks.test.TestObject- Returns:
- null
-
getFailedTests
Gets the "children" of this test result that failed- Overrides:
getFailedTestsin 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:
getPassedTestsin 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:
getSkippedTestsin 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:
getErrorStackTracein classhudson.tasks.test.TestResult
-
getErrorDetails
If there was an error or a failure, this is the text from the message.- Overrides:
getErrorDetailsin classhudson.tasks.test.TestResult
-
isPassed
public boolean isPassed()- Overrides:
isPassedin 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:
getOwnerin classhudson.tasks.junit.TestObject
-
setParentSuiteResult
-
freeze
-
compareTo
- Specified by:
compareToin interfaceComparable<FlakyCaseResult>
-
equals
-
hashCode
public int hashCode() -
getStatus
-
getTestAction
public hudson.tasks.junit.TestAction getTestAction()- Specified by:
getTestActionin interfaceActionableFlakyTestObject
-