java—如何引用jenkins(松弛集成)中的成功/失败测试

velaa5lx  于 2021-07-03  发布在  Java
关注(0)|答案(0)|浏览(209)

如何获得slack中提到的成功和失败测试的计数(如何引用测试)?目前,我只有成功和失败的职位,但发现很难实现失败和成功的测试计数
这是我的Jenkins档案

slackChannelName = 'ci'

pipeline {
    agent {
        label 'dev-ci-worker'
    }
    triggers {
        cron(env.BRANCH_NAME == 'master' ? 'H 1 * * *' : '')
    }
    stages {
        stage('Initialize') {
            steps {
                script {
                    env.WORKSPACE_DIR = pwd()
                    echo "Workspace directory: ${env.WORKSPACE_DIR}"
                }
            }
        }
        stage('Testing') {
            steps {
                sh 'GRADLE_OPTS="-Xms1512m -Xmx2048m" ./gradlew clean :test'
            }
            post {
                always {
                    junit "build/test-results/test/*.xml"
                    publishHTML(
                            [
                                    allowMissing         : true,
                                    alwaysLinkToLastBuild: false,
                                    keepAll              : true,
                                    reportDir            : "build/reports/tests/test",
                                    reportFiles          : 'index.html',
                                    reportName           : 'JUnit Test Report',
                                    reportTitles         : 'JUnit Test Report'
                            ]
                    )
                }
            }
        }
    }
    post {
        success {
            slackSend(
                    message: "Web E2E tests, great success!",
                    channel: "#${slackChannelName}",
                    color: "success"
            )
        }
        failure {
            slackSend(
                    message: "Web E2E test failed",
                    channel: "#${slackChannelName}",
                    color: "danger"
            )
        }
    }
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题