无论如何,是否有将cobertura coverage xml报告合并在一起的方法? [英] Is there anyway to merge cobertura coverage xml reports together?

查看:224
本文介绍了无论如何,是否有将cobertura coverage xml报告合并在一起的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有带有大量单元测试的c ++/c应用程序.我希望获得每个测试的整体覆盖率以及单个测试的覆盖率,但条件是每个测试只能运行一次. 覆盖格式必须为xml(cobertura xml),jenkins的cobertura插件才能处理.

I have c++/c application with a lots of unit tests. I would like to get overall coverage and also individual coverage of each test with condition that each test can be run only once. Format of coverage must be xml (cobertura xml) for jenkins cobertura plugin to process.

到目前为止,我在编译时生成gcno文件,而在使用source时生成gcda文件.然后调用gcovr获取xml文件.

So far I generate gcno files upon compilation and gcda files when source is used. Then call gcovr to get xml file.

我想创建每个单元测试的coverage(因此为每个单元测试创​​建coverage xml),然后将这些xml文件合并为一个xml文件.

I would like to create coverage of each unit test (thus creating coverage xml for every unit test) and then merge these xml files into one xml file.

谢谢!

推荐答案

我写了

I wrote python script which can merge cobertura reports together. It only merges line "hits" and is able to filter specific packages while merging.

有条件的(分支率)覆盖率和行的覆盖率( line-rate )百分比值尚未合并. Jenkins插件会重新计算这些值,因此在这种情况下不必实现(但也许会实现).

Conditional(branch-rate) coverage and line coverage (line-rate) percentage values are not merged yet. Jenkins plugin recalculates these values so in this context it doesn't have to be implemented (but maybe it will).

而且条件覆盖似乎无法轻松地组合在一起,因此当报表根据最终值进行协作时(这意味着一个文件具有条件覆盖范围50% (2/4),另外一个文件具有条件覆盖范围50% (2/4))另外两个则不起作用结果设置为这两个数字中的较高者,因此仍为50% (2/4)

Also conditional coverage can't seem to be put together easily, so it doesn't work when reports cooperate on final value (meaning one file has condition-coverage 50% (2/4) and other also condition-coverage 50% (2/4) other two branches. Result is set to be higher of these two numbers so it will be still 50% (2/4)

这篇关于无论如何,是否有将cobertura coverage xml报告合并在一起的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆