jenkins junit

pipeline{
    agent any 
    environment {
        def appdir = "*"
    }
    stages{
        stage('clear dir'){
            steps{
                echo "clear dir"
                sh  '''
                    #!/bin/bash -xe
                    rm -rf ./*
                    '''
            }
        }
        stage('pull code and config'){
            steps{
                echo "checkout from git"
                sh "git clone *"
            }
        }
        stage('compile and package'){
            steps{
                echo "compile and package"
                sh '''
                    cd ${app_name}
                    mvn clean package
                '''
            }
#########################################
            post {
                always{
                     junit ( testResults: '**/surefire-reports/*.xml' )
                }
            } 
#########################################
        }

    }
}

生成的测试报告默认在target的surefire-reports下面。

posted @ 2021-03-31 15:09  腐汝  阅读(134)  评论(0编辑  收藏  举报