我有一些在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有所不同。
谁知道正确使用XML1.4测试结果UnitTest++输出需要哪条Jenkinsfile语句?
发布于 2017-01-09 01:15:44
解决方案是,如果使用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
]]
])https://stackoverflow.com/questions/41513479
复制相似问题