maxi175 maxi175 - 2 years ago 86
Java Question

Jacoco-what does ''class missed'' means?

I didn't find enough information for MISSEDCOUNT

<rules>
<rule implementation="org.jacoco.maven.RuleConfiguration">
<element>BUNDLE</element>
<limits>
<limit implementation="org.jacoco.report.check.Limit">
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>0.80</minimum>
</limit>
<limit implementation="org.jacoco.report.check.Limit">
<counter>CLASS</counter>
<value>MISSEDCOUNT</value>
<maximum>0</maximum>
</limit>
</limits>
</rule>
</rules>


I also encountered an error:

Rule violated for bundle xxxx: classes missed count is 1, but expected maximum is 0)


Could you give me a simple example when it could be thrown as well as should i use this check(MISSEDCOUNT) in my java project?

Answer Source

MISSEDCOUNT refers to the number of branches/classes/etc. (in this case classes because you have used CLASS) which are not tested. Using MISSEDCOUNT with a value of 0 will cause the build to fail if there are any classes that are not tested.

The error makes sense, because it sounds like there is 1 class in your project which is not tested (classes missed count is 1), but because you have specified a maximum of 0 allowable classes to be missed (expected maximum is 0), the build has failed.

See: http://www.eclemma.org/jacoco/trunk/doc/check-mojo.html#rules

Whether or not you "should" use the MISSEDCOUNT check is entirely up to you. If you want to enforce comprehensive testing, then yes, I would include it. If there are some classes which simply cannot be tested for some reason, then you can always increase the count.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download