Eclipse [EclEmma]中的覆盖排除无效吗? [英] Coverage exclusion in Eclipse [EclEmma] is not working?

查看:154
本文介绍了Eclipse [EclEmma]中的覆盖排除无效吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据





但是,在运行coverage操作之后,排除设置不起作用:



可以看到,被排除的软件包仍被包括在总体覆盖测试中。此外,如果您在包含中标记 *,而在排除中标记包装,则仍不排除它。



根据此问题上帝的回答


不幸的是,如 [问题]


但是,这个问题已经解决了岁。 我问我是不是做错了什么,还是这个问题仍然存在?如果这两个字段不能按预期工作,那么包含这两个字段有什么意义呢?



版本:


Eclipse:氧气释放(4.7.0)



解决方案

我认为对于这些字段当前的工作方式存在误解,因为


但是,尽管 includes字段按上述方式工作,但 excludes字段却没有。


关于 includes字段的陈述是不正确的,甚至在您的屏幕截图中也是如此-仅有 audio。* Languistics。 / code>包括在内,报告中还有其他软件包。



这就是为什么:这些字段与覆盖率运行时,并分别对应于 JaCoCo代理程序的选项-它们允许指定将要修改其字节码的类,它们不包括/不包括在报告生成中的类。字节码未修改的类将在报告中显示为 0%。如您引用的中所述,在字节码修改干扰被测代码的极少数情况下,这种规范非常有用。文档


出于技术原因,可能有必要从代码覆盖率分析中排除某些类。以下选项将Coverage Agent配置为从分析中排除某些类别。 除了性能优化或技术特殊情况外,通常不需要这些选项。


以及以下几行:


警告: ... ...排除的类仍将显示为未覆盖。


所以是的-报告仍然没有排除。


但是,这个问题已经存在了一年多。


Eclipse EclEmma Project是开源的,因此随时可以实现此功能并回馈。


According to this post on StackOverflow and EclEmma's documentation, exclusion of classes from the coverage should be very possible. However, while the "includes" field works just as described, the "excludes" field does not.

Take the following project hierarchy and coverage runtime settings respectively:

But, after running the coverage operation, the exclude setting does not work:

As one can see, the excluded package is still being included in the overall coverage testing. In addition, if you mark '*' in "includes" and mark a package in the "excludes," it is still not excluded.

According to this issue and Godlin's answer:

Unfortunately currently EclEmma does not support exclusions from the report as stated in [issue]

However, this problem is well over a year old. I am asking if I am doing something incorrect or if this problem is still ongoing? What is the point of including these two fields if they don't work as intended?

Version(s):

Eclipse: Oxygen Release (4.7.0)

解决方案

I think there is misunderstanding about how these fields currently work, because

However, while the "includes" field works just as described, the "excludes" field does not.

this statement about "includes" field is incorrect as even shown on your screenshot - while only audio.* and linguistics.* are included, there are other packages in a report.

And here is why: these fields are about "Coverage Runtime" and correspond to respective options of JaCoCo agent - they allow to specify classes whose bytecode will be modified, they do not include/exclude classes from generation of report. Classes whose bytecode wasn't modified will be presented in report with "0%". Such specification is useful for the rare cases when bytecode modification interferes with code under test as stated in cited by you documentation:

For technical reasons it might be necessary to exclude certain classes from code coverage analysis. The following options configure the coverage agent to exclude certain classes from analysis. Except for performance optimization or technical corner cases these options are normally not required.

and few lines below:

Warning: ... Excluded classes will still show as not covered.

And so yes - there is still no exclusions for report.

However, this problem is well over a year old.

Eclipse EclEmma Project is open-source, so feel free to implement this feature and contribute back.

这篇关于Eclipse [EclEmma]中的覆盖排除无效吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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