邮递员报告未在管道中生成html代码

时间:2019-08-13 06:42:59

标签: groovy jenkins-pipeline newman

我正在尝试执行一个newman命令,该命令使用Groovy在jenkins管道上运行一些邮递员集合。我需要html-extra才能在管道结尾生成邮递员报告。测试运行良好,但html报告未生成给我。

这是Groovy的代码:

def call() {
    pipeline { 
        agent any 

        parameters {
            string(name: 'branch', defaultValue: 'refs/heads/develop', description: 'git branch where fetch sourcecode')
        }

        environment {
            TOOL_MAVEN_ID = 'Maven3'
            TOOL_JDK_ID = 'jdk 1.8.0_144'

            GIT_URL = getGitRepoURL()
            GIT_CREDENTIALS = '*****'
        }

        tools { 
            maven env.TOOL_MAVEN_ID
            jdk env.TOOL_JDK_ID
        }

        triggers {
            cron('H 06 * * 1-5')    
        }

        stages {
            stage ('Initialize'){
                steps { 
                    echo 'initializing'
                    deleteDir()
                    bat '''
                        echo "PATH = %PATH%"
                        echo "M2_HOME = %M2_HOME%"
                    ''' 
                }
            }

            stage ('Sourcecode'){
                steps { 
                    echo 'fetching sourcecode from ' + env.GIT_URL
                    checkout([$class: 'GitSCM', branches: [[name: params.branch]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: env.GIT_CREDENTIALS, url: env.GIT_URL]]])            
                }
            }

            stage ('Compile'){
                steps { 
                    bat 'mvn clean verify -Denvironment=pre'
                }
            }

            stage ('Postman Collections'){
                steps { 
                    echo 'executing Postman Collections'
                    bat 'newman run src/test/postman/API_postman_collections.json -e src/test/postman/Preproduccion.postman_environment.json -r json,htmlextra --reporter-htmlextra-export target/newman/report.html --reporter-json-export target/newman/report.json -k'
                }
            }

        }
    }
}

0 个答案:

没有答案
相关问题