我有以下Jenkinsfile:
pipeline{
stages
{
stage ("Compile Everything") {/**/} // Code coverage flags turned on
// Stashes compiled test binaries.
stage ("Parallel Tests"){
parallel{
stage ("Run Tests A-L") {/**/} // These stages unstash and run groups of tests,
stage ("Run Tests L-Z") {/**/} // causing coverage files to be created.
// I analyze those coverage files via
// gcovr and stash the results as xml.
}
}
stage ("Combine and Publish Coverage") {/**/} // Here I can unstash all of the xml
// code coverage files, but don't know
// how to combine them.
}
}
在最后一个阶段,“合并和发布Coverage”是否可以合并gcovr创建的所有xml文件?
有人解决了并行测试并以另一种方式完全合并覆盖结果的问题吗?
答案 0 :(得分:0)
以下解决方案并不像我想要的那样优雅,但是我能提供的最好的解决方案。
使用lcov
代替gcovr
最初生成覆盖率报告。这将创建.info
个文件,其中lcov
可以合并为单个.info
文件。
解压缩前阶段的所有.info
文件,然后使用lcov -a
将它们组合成单个.info
文件。 (Reference)
接下来,使用lcov-to-cobertura
转换器将此.info
文件转换为可以报告给SonarQube的xml文件。