【问题标题】:How to use jenkins pipeline script with UnitTest++ 1.4如何在 UnitTest++ 1.4 中使用詹金斯管道脚本
【发布时间】:2017-10-27 04:14:09
【问题描述】:

我有一些基于 jenkins 构建的 C++ 代码。我运行 UnitTest++ 1.4 来测试 C++ 代码,这会生成一些 TestResults*.xml

只要我使用 web 前端配置 jenkins 构建作业,这就会很好:

对于一个新的构建工作,我必须改用 jenkins 管道插件,所以我必须编写一个 Jenkinsfile。为了评估我的TestResults*.xml,我只找到了两种选择:

junit 'TestResults*.xml'
step([$class: 'JUnitResultArchiver', testResults: 'TestResults*.xml'])

但它们都不起作用。似乎junit xml格式与UnitTest++ 1.4不同。

有谁知道正确使用UnitTest++ 1.4测试结果xml输出需要哪个Jenkinsfile语句?

【问题讨论】:

    标签: unit-testing jenkins jenkinsfile


    【解决方案1】:

    解决方案是,如果 JUnit 插件,则使用 xUnit 插件。像这样:

    step([
        $class: 'XUnitBuilder', testTimeMargin: '3000', thresholdMode: 1,
        thresholds: [
            [$class: 'FailedThreshold', failureNewThreshold: '', failureThreshold: '0', unstableNewThreshold: '', unstableThreshold: ''],
            [$class: 'SkippedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '']
        ],
        tools: [[
            $class: 'UnitTestJunitHudsonTestType',
            deleteOutputFiles: true,
            failIfNotNew: true,
            pattern: 'result.xml',
            skipNoTestFiles: false,
            stopProcessingIfError: true
        ]]
    ])
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-06
    • 2018-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多