Home > Net >  Jenkins and newman - report not showing
Jenkins and newman - report not showing

Time:10-24

I've defined the following step in a JenkinsFile which generates an html report while running the Jenkins pipeline:

        stage('Run Integration Tests') {
            steps {
                        dir("${env.WORKSPACE}/test/integration") {
                            sh'''
                                npm install -g newman
                                npm install -g newman-reporter-htmlextra
                                newman run postman_collection.json -e '''  APIGEE_ENVIRONMENT '''.postman_environment.json --reporters cli,htmlextra --reporter-htmlextra-export "newman_result.html"
                            '''
                        }
            }
        }

I then try to publish this report, but whatever I try, it doesn't show the report but instead shows an empty html page. I'm probably messing something up in the configuration but I'm stuck on this for several hours now. I hope anyone finds the missing piece. Thank you so much in advance.

        stage('Artifacts') {
            steps {
                publishHTML(target: [
                    alwaysLinkToLastBuild: false,
                    allowMissing: false,
                    keepAll: true,
                    reportDir: "${WORKSPACE}",
                    reportFiles: 'newman_result.html',
                    reportName: 'Integration Test Results',
                    reportTitles: ''
                ])
            }
        }

CodePudding user response:

turns out the issue was with the reportDir. The report was being generated in folder /test/integration so I had to change the reportDir attribute to:

reportDir: "${WORKSPACE}",
  • Related