1

My program uses a custom testing framework but saves test results to an XML file following JUnit XML formatting as described here: JUnit XML format specification that Hudson supports. Jenkins is able to parse the file as expected, using the xunit plugin, and to display informative test results. However, it only sees the file when I do a manual build and a git add/commit of the test results file. What do I need to do so that Jenkins will "see" a result file that is created during the execution of the pipeline?

Here is my Jenkinsfile:

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                sh 'xcodebuild -scheme UnitTestRunner -configuration debug'
            }
        }
        stage('Test') {
            steps {
                sh 'xcodebuild -scheme UnitTestRunner -configuration debug || true'
                junit '**/TestResults.xml'
            }
        }
    }
}
Community
  • 1
  • 1
compmuse
  • 11
  • 1
  • 3

2 Answers2

1

to make the test results available for other stages, or even for downloading them from other applications (e.g. a test management tool) you need to publish them as artifacts:

stage('Test') {
            steps {
                sh 'xcodebuild -scheme UnitTestRunner -configuration debug || true'
                junit '**/TestResults.xml'
                archiveArtifacts artifacts: '**/TestResults.xml'
            }
        }
astrograph
  • 48
  • 7
0

You should check if the result file is generated in your workspace. Check the workspace itself or use archiveArtifacts to archive all files. Then you just need to define the correct pattern for the file. Be sure that you have the result file in the same node or stash it to publish in another node later.

Christopher
  • 1,103
  • 1
  • 6
  • 18