如何使用Jenkins管道和xUnit插件发布Boost单元测试

use*_*642 7 continuous-integration boost unit-testing xunit jenkins

我正在将旧的Jenkins构建迁移到声明性管道.我们使用xUnit插件发布单元测试,对于JUnit,以下工作正常:

step([$class: 'XUnitBuilder',
      thresholds: [[$class: 'FailedThreshold', unstableThreshold: '1']],
      tools: [[$class: 'JUnitType', pattern: '**/surefire-reports/*.xml'],
              [$class: 'JUnitType', pattern: '**/generatedJUnitFiles/JUnit/*.xml'],]
     ])
Run Code Online (Sandbox Code Playgroud)

我的问题是我无法弄清楚如何发布我们的助推测试.是否有BoostType类似JUnitType或不支持的增强测试?

Oli*_*erM 8

新的xUnit插件语法是有点更轻,更具可读性:

pipeline {
    agent any
    stages {
        stage('Test'){
            steps {
                sh "run_tests.bash"
            }
        }
    }
    post {
        always{
            xunit (
                thresholds: [ skipped(failureThreshold: '0'), failed(failureThreshold: '0') ],
                tools: [
                    JUnit(pattern: '**/surefire-reports/*.xml'),
                    JUnit(pattern: '**/generatedJUnitFiles/JUnit/*.xml'),
                    BoostTest(pattern: '**/*_results.xml')]
            )
        }
    }
 }
Run Code Online (Sandbox Code Playgroud)


use*_*642 7

答案结果是BoostTestJunitHudsonTestType.这是代码:

step([$class: 'XUnitBuilder',
            thresholds: [[$class: 'FailedThreshold', unstableThreshold: '1']],
            tools: [[$class: 'JUnitType', pattern: '**/surefire-reports/*.xml'],
                    [$class: 'JUnitType', pattern: '**/generatedJUnitFiles/JUnit/*.xml'],
                    [$class: 'BoostTestJunitHudsonTestType', pattern: '**/*_results.xml'],
                     ]])
Run Code Online (Sandbox Code Playgroud)