【问题标题】:How do I publish Boost unit tests with Jenkins pipeline and xUnit plugin如何使用 Jenkins 管道和 xUnit 插件发布 Boost 单元测试
【发布时间】:2017-12-21 08:42:27
【问题描述】:

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

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

我的问题是我不知道如何发布我们的增强测试。是否有类似于JUnitTypeBoostType,或者还不支持提升测试?

【问题讨论】:

    标签: unit-testing jenkins boost continuous-integration xunit


    【解决方案1】:

    在 Jenkins 的 xUnit Plugin 中有一个类 BoostTest

    【讨论】:

    • 感谢您的帮助。它实际上是 BoostTestJunitHudsonTestType。
    【解决方案2】:

    答案竟然是 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() 命令及其语法的文档?我什么也没找到。
    【解决方案3】:

    new xunit Plugin syntax 更轻更易读:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-27
      • 1970-01-01
      • 2018-12-06
      • 2018-05-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多