Jacoco Coverage Report is displaying excluded folders with 0% coverage

喜你入骨 提交于 2019-12-25 08:19:52

问题


I have attached jacocoagent with my Tomcat server. I am able to get data in jacoco.exec and HTML report but I want to exclude some folders from my coverage report. After adding following command, now I can see excluded folders name in my coverage report with 0% coverage. How can I exclude the following folders from the report.

Are these excluded folders still contributing in total coverage percentage which is 15% at the moment?

I have added following command in my Catilina.bat file:

set JAVA_OPTS=%JAVA_OPTS% -javaagent:"C:/git/project/jacoco/lib/jacocoagent.jar=destfile=C:/git/project/jacoco/dump/jacoco.exec,dumponexit=true,output=file,append=true,excludes=oracle.* :vm.*"
Versions:
Tomcat Server : 7
Operating system : Windows
Jacoco : 0.7.6.201602180812

回答1:


Usage of JaCoCo involves two steps:

  1. gathering of coverage information
  2. generation of report

Both can have exclusions. As of today exclusions specified in configuration of agent affect only first step and won't cause automatic exclusion in second step. Why? Because otherwise code that is never executed won't appear in reports. And as stated in JaCoCo agent documentation about option "excludes":

Except for performance optimization or technical corner cases this option is normally not required.

So to really exclude classes from report you should configure step of report generation.



来源:https://stackoverflow.com/questions/40354640/jacoco-coverage-report-is-displaying-excluded-folders-with-0-coverage

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