Coverage exclusion in Eclipse [EclEmma] is not working?

北慕城南 提交于 2019-12-20 05:40:29

问题


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)


回答1:


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.



来源:https://stackoverflow.com/questions/47703999/coverage-exclusion-in-eclipse-eclemma-is-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!