0

I have created pipeline in Jenkins for running my postman collection via Newman on centOS7.6. collection is running successfully but failing at stage of creating a report with below error -- ERROR: No test report files were found. Configuration error? Finished: FAILURE*

Could you help in resolving the problem?

pipeline:

    currentBuild.displayName="Prod-API-AUtomation-#"+currentBuild.number
    pipeline{
            agent any
            tools {nodejs "NodeJS"}
            stages{
                stage("Building"){
                    steps{
                        sh 'npm install -g newman'
                        sh 'npm install -g newman-reporter-htmlextra'
                    }
                }
                stage("Execute Collection"){
                    steps{
                        script{
                            try{
                                sh "newman run Test.postman_collection.json -e Test.postman_environment.json -r cli,junit,htmlextra --reporter-junit-export $WORKSPACE/newman/prod_report.xml --reporter-htmlextra-export $WORKSPACE/newman/prod_Report.html"
                                currentBuild.result="SUCCESS"
                            }catch(Exception ex){
                                currentBuild.result="FAILURE"
                            }
                        }
                    }
                }
                stage("Generating Report"){
                    steps{
                        publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: false, reportDir: 'newman', reportFiles: '$WORKSPACE/newman', reportName: 'HTML Report', reportTitles: ''])
                        junit '$WORKSPACE/newman/prod_report.xml'
                    }
                }
            }
   }
  • In the `publishHTML` the `reportDir` should be **'$WORKSPACE/newman'**, and the `reportFiles` should be **'prod_report.xml'** – Noam Helmer Jun 28 '21 at 11:04

2 Answers2

0

You need to provide the directory in the reportdir as shown below:

stage("Generating Report"){
                    steps{
                        publishHTML([allowMissing: false, alwaysLinkToLastBuild: true, keepAll: false, reportDir: '$WORKSPACE/newman', reportFiles: 'prod_report.xml', reportName: 'HTML Report', reportTitles: ''])
                        junit '$WORKSPACE/newman/prod_report.xml'
                    }

Altaf
  • 2,838
  • 1
  • 16
  • 8
0

Please use jaiman for jenkins and mailing integration. this is very useful when you are integrating for parallel execution in jenkins.

https://www.npmjs.com/package/jaiman

Jayanth Bala
  • 758
  • 1
  • 5
  • 11
  • Hello @jayanth-bala. I used your product. But it is not possible to send the report to my smtp server because it is impossible to enter authorization data. Could you please share the source code to fix or fix this issue? Or post it on github as newman? – Alexis_Shef_777 Jan 10 '22 at 08:33