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

Annotate test results with a test run name

    Details

    • Type: Improvement
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Duplicate
    • Component/s: junit-plugin
    • Labels:
      None
    • Similar Issues:

      Description

      When you have multiple test runs using pipelines, it would be super awesome to be able to annotate the different test runs with a name to allow differentiation, e.g.

      node('windows') {
        ...
        junit testResults:'target/tests.xml' testRunName: 'windows'
      }
      node('linux') {
        ...
        junit testResults:'target/tests.xml' testRunName: 'linux'
      }
      

      This way you can tell which test run the tests came from.

      The following screenshot illustrates how this would apply (by basically appending the test run name to each case)

        Attachments

          Issue Links

            Activity

            Hide
            sithmein Thorsten Meinl added a comment -

            This is a very good idea and makes replacing matrix jobs with (parallel) pipelines easier.

            Show
            sithmein Thorsten Meinl added a comment - This is a very good idea and makes replacing matrix jobs with (parallel) pipelines easier.
            Hide
            olamy Olivier Lamy added a comment - - edited

            I'm not sure why it's marked as duplicated/resolved?
            what is the way to achieve this?
            Simplified Jenkinsfile

            def jdks = ["jdk8", "jdk9"]
            def oss = ["linux","windows","osx"]
            def builds = [:]
            for (def os in oss) {
              for (def jdk in jdks) {
                builds[os+"_"+jdk] = getFullBuild( jdk, os )
              }
            }
            
            def getFullBuild(jdk, os) {
              return {
                node(os) {
                  // System Dependent Locations
                  def mvntool = tool name: 'maven3', type: 'hudson.tasks.Maven$MavenInstallation'
                  def jdktool = tool name: "$jdk", type: 'hudson.model.JDK'
            
                  // Environment
                  List mvnEnv = ["PATH+MVN=${mvntool}/bin", "PATH+JDK=${jdktool}/bin", "JAVA_HOME=${jdktool}/", "MAVEN_HOME=${mvntool}"]
                  mvnEnv.add("MAVEN_OPTS=-Xms256m -Xmx1024m -Djava.awt.headless=true")
            
                  withEnv(mvnEnv) {
                        timeout(time: 90, unit: 'MINUTES') {
                          // Run test phase / ignore test failures
                          sh "mvn -V -B install -Dmaven.test.failure.ignore=true -Prun-its"
                          // Report failures in the jenkins UI
                          step([$class: 'JUnitResultArchiver',
                                testResults: '**/target/surefire-reports/TEST-*.xml'])
            
                  }
                }
               }
            
            

            All test add aggregated in a single junit result and I cannot find which jdk/os failed
            I would be happy to use something such

                          step([$class: 'JUnitResultArchiver',
                                testResults: '**/target/surefire-reports/TEST-*.xml', testRunName: $jdk+"_"+$os])
            
            Show
            olamy Olivier Lamy added a comment - - edited I'm not sure why it's marked as duplicated/resolved? what is the way to achieve this? Simplified Jenkinsfile def jdks = [ "jdk8" , "jdk9" ] def oss = [ "linux" , "windows" , "osx" ] def builds = [:] for (def os in oss) { for (def jdk in jdks) { builds[os+ "_" +jdk] = getFullBuild( jdk, os ) } } def getFullBuild(jdk, os) { return { node(os) { // System Dependent Locations def mvntool = tool name: 'maven3' , type: 'hudson.tasks.Maven$MavenInstallation' def jdktool = tool name: "$jdk" , type: 'hudson.model.JDK' // Environment List mvnEnv = [ "PATH+MVN=${mvntool}/bin" , "PATH+JDK=${jdktool}/bin" , "JAVA_HOME=${jdktool}/" , "MAVEN_HOME=${mvntool}" ] mvnEnv.add( "MAVEN_OPTS=-Xms256m -Xmx1024m -Djava.awt.headless= true " ) withEnv(mvnEnv) { timeout(time: 90, unit: 'MINUTES' ) { // Run test phase / ignore test failures sh "mvn -V -B install -Dmaven.test.failure.ignore= true -Prun-its" // Report failures in the jenkins UI step([$class: 'JUnitResultArchiver' , testResults: '**/target/surefire-reports/TEST-*.xml' ]) } } } All test add aggregated in a single junit result and I cannot find which jdk/os failed I would be happy to use something such step([$class: 'JUnitResultArchiver' , testResults: '**/target/surefire-reports/TEST-*.xml' , testRunName: $jdk+ "_" +$os])

              People

              • Assignee:
                stephenconnolly Stephen Connolly
                Reporter:
                stephenconnolly Stephen Connolly
              • Votes:
                2 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: