Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-53362

Update documentation for junit Pipeline step return value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • junit-plugin
    • None

      I just recently saw a discussion on gitter, where jglick mentioned that the junit task returns a hudson.tasks.junit.TestResultSummary.

      This is a very cool feature and I bet many people like to use it, but I couldn't find it anywhere in the official documentation.

      Jesse Glick @jglick Aug. 30 23:00
      @sshepel you need to use the return value from the junit step, as above

      Serhii Shepel @sshepel Aug. 30 23:01
      But ATM currentBuild.rawBuild.getAction(AbstractTestResultAction.class) returns summary for all mvn test calls...
      hm I didn't know that junit has return value
      interesting
      so, does this means that smth like this should work: def platformTestResults = junit allowEmptyResults: true, testResults: '*/target/surefire-reports/.xml'?

      Jesse Glick @jglick Aug. 30 23:33
      @sshepel yes

      Serhii Shepel @sshepel 00:08
      Ok, thanks @jglick will check that tomorrow

      Serhii Shepel @sshepel 00:33
      @jglick hm, decided to do a quick test, and got failure... What kind of value junit step shout return?
      I thought that it should be hudson.tasks.junit.TestResultAction, am I wrong?
      oh, strange it returns hudson.tasks.junit.TestResultSummary
      then how can I get failureDiffString

      Jesse Glick @jglick 02:16
      .failCount as previously mentioned

      Serhii Shepel @sshepel 10:32
      failCount will return Gets the total number of failed tests. whereas failureDiffString returns Gets the diff string of failures... Anyway I can live without it Once again, thanks a lot @jglick

       

            Unassigned Unassigned
            dageissl Daniel Geißler
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: