我该如何使用Jenkins pipeline和xUnit插件发布Boost单元测试?

9

我正在将我们旧的Jenkins构建迁移到声明性流水线。我们使用xUnit插件来发布单元测试,对于JUnit,以下内容就可以正常工作:

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

我的问题是我不知道如何发布我们的boost测试。是否有类似于JUnitType的BoostType,或者boost测试还没有得到支持?

3个回答

11

新的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')]
            )
        }
    }
 }

8
答案是BoostTestJunitHudsonTestType。以下是代码:

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'],
                     ]])

请问您能否指出一些解释step()命令及其语法的文档?我找不到任何相关资料。 - DBedrenko

3

1
感谢您的帮助。实际上是BoostTestJunitHudsonTestType。 - user3029642

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