Guy*_*ans 5 jenkins jenkins-plugins jenkins-groovy postman-newman
我在 JenkinsFile 中定义了以下步骤,该步骤在运行 Jenkins 管道时生成 html 报告:
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"
'''
}
}
}
Run Code Online (Sandbox Code Playgroud)
然后我尝试发布此报告,但无论我尝试什么,它都不会显示该报告,而是显示一个空的 html 页面。我可能在配置中弄乱了一些东西,但我现在已经在这个问题上坚持了几个小时了。我希望有人能找到缺失的部分。预先非常感谢您。
stage('Artifacts') {
steps {
publishHTML(target: [
alwaysLinkToLastBuild: false,
allowMissing: false,
keepAll: true,
reportDir: "${WORKSPACE}",
reportFiles: 'newman_result.html',
reportName: 'Integration Test Results',
reportTitles: ''
])
}
}
Run Code Online (Sandbox Code Playgroud)
事实证明问题出在reportDir上。该报告是在文件夹 /test/integration 中生成的,因此我必须将 reportDir 属性更改为:
reportDir: "${WORKSPACE}/test/integration",
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
446 次 |
| 最近记录: |