我在 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'
}
}
}
}
答案 0 :(得分: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'
}