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:
  • Constructor Details

    • FlakyCaseResult

      public FlakyCaseResult(FlakySuiteResult parent, String testName, String errorStackTrace)
      Used to create a fake failure, when Hudson fails to load data from XML files. Public since 1.526.
      Parameters:
      parent - suite result
      testName - test name
      errorStackTrace - stack trace
  • Method Details

    • getParent

      public FlakyClassResult getParent()
      Specified by:
      getParent in class hudson.tasks.test.TestObject
    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in interface ModelObject
    • getFlakyRuns

      public List<FlakyCaseResult.FlakyRunInformation> getFlakyRuns()
    • getName

      @Exported(visibility=999) public String getName()
      Gets the name of the test, which is returned from TestCase.getName()

      Note that this may contain any URL-unfriendly character.

      Overrides:
      getName in class hudson.tasks.test.TestObject
    • getTitle

      public String getTitle()
      Gets the human readable title of this result object.
      Overrides:
      getTitle in class hudson.tasks.test.TestResult
    • getDuration

      @Exported(visibility=9) public float getDuration()
      Gets the duration of the test, in seconds
      Overrides:
      getDuration in class hudson.tasks.test.TestResult
    • getSafeName

      public String getSafeName()
      Gets the version of getName() that's URL-safe.
      Overrides:
      getSafeName in class hudson.tasks.test.TestObject
    • getClassName

      @Exported(visibility=9) public String getClassName()
      Gets the class name of a test class.
      Returns:
      class name
    • getSimpleName

      public String getSimpleName()
      Gets the simple (not qualified) class name.
      Returns:
      simple class name
    • getPackageName

      public String getPackageName()
      Gets the package name of a test case
      Returns:
      package name
    • getFullName

      public String getFullName()
      Overrides:
      getFullName in class hudson.tasks.test.TestObject
    • getFullDisplayName

      public String getFullDisplayName()
      Overrides:
      getFullDisplayName in class hudson.tasks.test.TestObject
      Returns:
      full display name
      Since:
      1.515
    • getFailCount

      public int getFailCount()
      Overrides:
      getFailCount in class hudson.tasks.test.TestResult
    • getSkipCount

      public int getSkipCount()
      Overrides:
      getSkipCount in class hudson.tasks.test.TestResult
    • getPassCount

      public int getPassCount()
      Overrides:
      getPassCount in class hudson.tasks.test.TestResult
    • getStdout

      @Exported public String 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 class hudson.tasks.test.TestResult
      Since:
      1.294
    • getStderr

      @Exported public String getStderr()
      The stderr of this test.
      Overrides:
      getStderr in class hudson.tasks.test.TestResult
      Since:
      1.294
      See Also:
    • getPreviousResult

      public FlakyCaseResult getPreviousResult()
      Overrides:
      getPreviousResult in class hudson.tasks.test.TestResult
    • findCorrespondingResult

      public hudson.tasks.test.TestResult findCorrespondingResult(String id)
      Case results have no children
      Specified by:
      findCorrespondingResult in class hudson.tasks.test.TestObject
      Returns:
      null
    • getFailedTests

      public Collection<? extends hudson.tasks.test.TestResult> getFailedTests()
      Gets the "children" of this test result that failed
      Overrides:
      getFailedTests in class hudson.tasks.test.TestResult
      Returns:
      the children of this test result, if any, or an empty collection
    • getPassedTests

      public Collection<? extends hudson.tasks.test.TestResult> getPassedTests()
      Gets the "children" of this test result that passed
      Overrides:
      getPassedTests in class hudson.tasks.test.TestResult
      Returns:
      the children of this test result, if any, or an empty collection
    • getSkippedTests

      public Collection<? extends hudson.tasks.test.TestResult> getSkippedTests()
      Gets the "children" of this test result that were skipped
      Overrides:
      getSkippedTests in class hudson.tasks.test.TestResult
      Returns:
      the children of this test result, if any, or an empty list
    • getErrorStackTrace

      @Exported public String getErrorStackTrace()
      If there was an error or a failure, this is the stack trace, or otherwise null.
      Overrides:
      getErrorStackTrace in class hudson.tasks.test.TestResult
    • getErrorDetails

      @Exported public String getErrorDetails()
      If there was an error or a failure, this is the text from the message.
      Overrides:
      getErrorDetails in class hudson.tasks.test.TestResult
    • isPassed

      public boolean isPassed()
      Overrides:
      isPassed in class hudson.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

      @Exported public String 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

      public FlakySuiteResult getSuiteResult()
    • getOwner

      public AbstractBuild<?,?> getOwner()
      Overrides:
      getOwner in class hudson.tasks.junit.TestObject
    • setParentSuiteResult

      public void setParentSuiteResult(FlakySuiteResult parent)
    • freeze

      public void freeze(FlakySuiteResult parent)
    • compareTo

      public int compareTo(@Nonnull FlakyCaseResult that)
      Specified by:
      compareTo in interface Comparable<FlakyCaseResult>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getStatus

      @Exported(name="status", visibility=9) public FlakyCaseResult.Status getStatus()
    • getTestAction

      public hudson.tasks.junit.TestAction getTestAction()
      Specified by:
      getTestAction in interface ActionableFlakyTestObject