【发布时间】:2021-09-10 14:45:56
【问题描述】:
我在 Jenkins 中创建了管道,用于在 centOS7.6 上通过 Newman 运行我的邮递员集合。收集正在成功运行,但在创建报告的阶段失败并出现以下错误 - 错误:未找到测试报告文件。配置错误? 完成:失败*
您能帮忙解决问题吗?
管道:
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'
}
}
}
}
【问题讨论】:
-
在
publishHTML中reportDir应该是'$WORKSPACE/newman',reportFiles应该是'prod_report.xml' b>
标签: jenkins postman newman html-reports-jenkins