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'
                    }
                }
            }
   }
4

2 回答 2

0

请使用jaiman进行 jenkins 和邮件集成。当您在詹金斯中集成并行执行时,这非常有用。

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

于 2021-10-04T10:00:05.530 回答
0

您需要提供reportdir如下所示的目录:

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'
                    }

于 2021-06-28T11:46:30.307 回答