Upgrading from 0.8.2 and 0.8.3 and interfaces are failing coverage tests

20 views
Skip to first unread message

randall...@gmail.com

unread,
Dec 15, 2019, 11:33:11 AM12/15/19
to JaCoCo and EclEmma Users
In the JMRI project[1], we use JaCoCo to ensure:
- all classes have some coverage
- coverage does not fall below a specified threshold

I tried to update JaCoCo from version 0.8.2 and 0.8.3 [2] (0.8.5 shows the same behavior), and the Travis CI tests began failing with every interface without a default method not explicitly excluded from the coverage report with "lines covered count is 0, but expected minimum is 1".

Is there a way to exclude interfaces without default methods from the coverage report to avoid the need to manually exclude each and every one individually (our coverage count is too low to switch on a coverage requirement for every method at this point)?

The pom.xml that is in use is at https://github.com/rhwood/JMRI/blob/codecov/pom.xml (or would it be preferable to copy into a message?)

Marc Hoffmann

unread,
Dec 15, 2019, 2:31:38 PM12/15/19
to JaCoCo and EclEmma Users
Hi Randall,

good to hear that JMRI uses JaCoCo :)

Indeed in 0.8.3 we added empty classes to our reports: https://github.com/jacoco/jacoco/pull/817

In your configuration this leads to the side effect you’re describing for empty classes (e.g. interfaces without default methods). As a workaround you can specify a very low minimum coverage ratio, like this:

<rule>
  <element>SOURCEFILE</element>
  <limits>
    <limit>
      <counter>LINE</counter>
      <value>COVEREDRATIO</value>
      <minimum>0.00001</minimum>
    </limit>
  </limits>
</rule>

The ratio is not checked in case of empty classes.

Regards,
-marc



--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/38366ba0-1862-49f7-bf97-c9a9567228b0%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages