0

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

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

Jenkins-xUnit-Web

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

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

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

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

4

1 回答 1

0

解决方案是,如果 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
    ]]
])
于 2017-01-08T17:15:44.433 回答