Class FlakyTestResult

java.lang.Object
hudson.model.AbstractModelObject
hudson.tasks.junit.TestObject
hudson.tasks.test.TestObject
hudson.tasks.test.TestResult
hudson.tasks.test.TabulatedResult
hudson.tasks.test.MetaTabulatedResult
com.google.jenkins.flakyTestHandler.junit.FlakyTestResult
All Implemented Interfaces:
ModelObject, SearchableModelObject, SearchItem, Serializable

public final class FlakyTestResult extends hudson.tasks.test.MetaTabulatedResult
Root of all the test results for one build, including flaky runs information. Majority of code copied from hudson.tasks.junit.TestResult https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/tasks/junit/ TestResult.java
Author:
Qingzhou Luo
See Also:
  • Constructor Details

    • FlakyTestResult

      public FlakyTestResult(hudson.tasks.junit.TestResult testResult)
      Construct FlakyTestResult() from TestResult
      Parameters:
      testResult - result of tests
    • FlakyTestResult

      public FlakyTestResult()
  • Method Details

    • getParent

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

      public void setParent(hudson.tasks.test.TestObject parent)
      Overrides:
      setParent in class hudson.tasks.test.TestResult
    • parse

      public void parse(long buildTime, org.apache.tools.ant.DirectoryScanner results) throws IOException
      Collect reports from the given DirectoryScanner, while filtering out all files that were created before the given time.
      Parameters:
      buildTime - time of build
      results - directory scanner for result files
      Throws:
      IOException - throws exception when opening result files fails
    • parse

      public void parse(long buildTime, File baseDir, String[] reportFiles) throws IOException
      Collect reports from the given report files, while filtering out all files that were created before the given time.
      Parameters:
      buildTime - time of build
      baseDir - base directory
      reportFiles - report file names
      Throws:
      IOException - throws exception when opening result files fails
      Since:
      1.426
    • parse

      public void parse(long buildTime, Iterable<File> reportFiles) throws IOException
      Collect reports from the given report files
      Parameters:
      buildTime - time of build
      reportFiles - list of report files
      Throws:
      IOException - throws exception when opening result files fails
      Since:
      1.500
    • parse

      public void parse(File reportFile) throws IOException
      Parses an additional report file.
      Parameters:
      reportFile - additional report file
      Throws:
      IOException - throws exception when opening report file fails
    • getDisplayName

      public String getDisplayName()
    • getRun

      public Run<?,?> getRun()
      Overrides:
      getRun in class hudson.tasks.junit.TestObject
    • findCorrespondingResult

      public hudson.tasks.test.TestResult findCorrespondingResult(String id)
      Specified by:
      findCorrespondingResult in class hudson.tasks.test.TestObject
    • getTitle

      public String getTitle()
      Overrides:
      getTitle in class hudson.tasks.test.TestResult
    • getChildTitle

      public String getChildTitle()
      Overrides:
      getChildTitle in class hudson.tasks.test.TabulatedResult
    • getDuration

      @Exported(visibility=999) public float getDuration()
      Overrides:
      getDuration in class hudson.tasks.test.TestResult
    • getPassCount

      @Exported(visibility=999) public int getPassCount()
      Overrides:
      getPassCount in class hudson.tasks.test.TestResult
    • getFailCount

      @Exported(visibility=999) public int getFailCount()
      Overrides:
      getFailCount in class hudson.tasks.test.TestResult
    • getTotalCount

      public int getTotalCount()
      Overrides:
      getTotalCount in class hudson.tasks.test.TestObject
    • getSkipCount

      @Exported(visibility=999) public int getSkipCount()
      Overrides:
      getSkipCount in class hudson.tasks.test.TestResult
    • isEmpty

      @Exported(visibility=999) public boolean isEmpty()
    • getFailedTests

      public List<FlakyCaseResult> getFailedTests()
      Specified by:
      getFailedTests in class hudson.tasks.test.MetaTabulatedResult
    • getFlakyTests

      public List<FlakyCaseResult> getFlakyTests()
    • getAllTests

      public List<FlakyCaseResult> getAllTests()
    • 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
    • getStdout

      public String getStdout()
      Overrides:
      getStdout in class hudson.tasks.test.TestResult
    • getStderr

      public String getStderr()
      Overrides:
      getStderr in class hudson.tasks.test.TestResult
    • getErrorStackTrace

      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

      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.
    • getChildren

      public Collection<FlakyPackageResult> getChildren()
      Specified by:
      getChildren in class hudson.tasks.test.TabulatedResult
    • hasChildren

      public boolean hasChildren()
      Whether this test result has children.
      Specified by:
      hasChildren in class hudson.tasks.test.TabulatedResult
    • getSuites

      @Exported(inline=true, visibility=9) public Collection<FlakySuiteResult> getSuites()
    • getName

      public String getName()
      Overrides:
      getName in class hudson.tasks.test.TestObject
    • getDynamic

      public Object getDynamic(String token, org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
      Overrides:
      getDynamic in class hudson.tasks.test.TestObject
    • byPackage

      public FlakyPackageResult byPackage(String packageName)
    • getSuite

      public FlakySuiteResult getSuite(String name)
    • setParentAction

      public void setParentAction(hudson.tasks.test.AbstractTestResultAction action)
      Overrides:
      setParentAction in class hudson.tasks.test.TestResult
    • getParentAction

      public hudson.tasks.test.AbstractTestResultAction getParentAction()
      Overrides:
      getParentAction in class hudson.tasks.test.TestResult
    • tally

      public void tally()
      Recount my children.
      Overrides:
      tally in class hudson.tasks.test.TestResult
    • freeze

      public void freeze(hudson.tasks.test.AbstractTestResultAction parent, Run build)
      Builds up the transient part of the data structure from results parsed so far.

      After the data is frozen, more files can be parsed and then freeze can be called again.

    • getTestFlakyStatsMap

      Get the map between test name and a HistoryAggregatedFlakyTestResultAction.SingleTestFlakyStatsWithRevision, which counts all its passing runs and failing runs. No flake will be included, because a flake will be decomposed into a passing run with several failing runs.
      Returns:
      the map between test name and a HistoryAggregatedFlakyTestResultAction.SingleTestFlakyStatsWithRevision,