Jenkins和newman - 报告未显示

5

我已经在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"
                            '''
                        }
            }
        }

我尝试发布这份报告,但无论尝试什么,都不能显示报告,只显示一个空的HTML页面。我可能在配置上弄错了些什么,已经被卡了好几个小时了。希望有人能找到缺失的部分。非常感谢您的帮助。

        stage('Artifacts') {
            steps {
                publishHTML(target: [
                    alwaysLinkToLastBuild: false,
                    allowMissing: false,
                    keepAll: true,
                    reportDir: "${WORKSPACE}",
                    reportFiles: 'newman_result.html',
                    reportName: 'Integration Test Results',
                    reportTitles: ''
                ])
            }
        }
1个回答

2

原来问题出在报告目录(reportDir)上。报告生成在/test/integration文件夹中,因此我需要将reportDir属性更改为:

reportDir: "${WORKSPACE}/test/integration",

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接