Hi Marc,

1. yes
2. correct
3. correct
4. correct

Thanks,
Radu

On Fri, 23 Jun 2017 at 16:49 Marc R. Hoffmann <[email protected]>
wrote:

> Hi Radu,
>
> please let me ask some questions to make sure I fully understand your
> setup:
>
> 1) By "running on Jenkins" you mean executing your Maven build within
> jenkins, right?
> 2) You're not using the JaCoCo Jenkins plugin at all, right?
> 3) The interfaces with default methods do show in the coverage report
> but the default methods are not marked as executed (red), right?
> 4) The interfaces are not listed on the "Sessions" page of the JaCoCo
> HTML report, right?
>
> Cheers,
> -marc
>
> On 23.06.17 11:23, [email protected] wrote:
> > Hello Jacoco users and devs,
> >
> > I have a relatively weird problem on my hands and after one day of doing
> everything that I could have thought of I still haven't found a solution.
> >
> > In our project we have a set of public interfaces with default methods.
> The default behaviour is that they throw UnsupportedOperationException,
> allowing the implementations to decide which API level they want to support.
> >
> > Since I wanted the team to use the same pattern for these interfaces,
> I've also added a unit test that checks that all the interfaces from the
> public API packages respect this pattern, by making sure we only expose
> default methods and that when invoked (using reflection) they throw UOE.
> >
> > Running the build locally on Mac OS X (Java 1.8.0_112, HotSpot), Windows
> (1.8.0_121) and Linux (OpenJDK 1.8.0_131) everything works perfectly:
> >
> > 1. JaCoCo runs offline instrumentation (because we also have to use
> Powermock for some of the tests)
> > 2. we run the tests
> > 3. JaCoCo restores the classes
> > 4. we generate the coverage report
> > 5. we run the check (every class has to be at least 80% covered, same
> applies for the project)
> >
> > When we try to run the same thing on Jenkins the check fails, since the
> interfaces I told you about are not analysed at all.
> >
> > Jenkins runs Java 1.8.0_121, also HotSpot. Comparing a local session
> with the one from Jenkins clearly shows that the interfaces are missing
> altogether from the analysis on Jenkins. Running the build in debug mode
> (mvn -X) didn't show anything revealing. There's no JaCoCo plugin installed
> on Jenkins that could clash with the project's setup.
> >
> > Any advice about what should I check more?
> >
> > For reference, this is the JaCoCo config (both the plugin and the agent
> have the same version - currently 0.7.6, but I've had the same results with
> 0.7.9):
> >
> >          <plugin>
> >                  <groupId>org.jacoco</groupId>
> >                  <artifactId>jacoco-maven-plugin</artifactId>
> >                  <executions>
> >                      <execution>
> >                          <id>default-instrument</id>
> >                          <goals>
> >                              <goal>instrument</goal>
> >                          </goals>
> >                      </execution>
> >                      <execution>
> >                          <id>default-restore-instrumented-classes</id>
> >                          <goals>
> >                              <goal>restore-instrumented-classes</goal>
> >                          </goals>
> >                      </execution>
> >                      <execution>
> >                          <id>check-coverage</id>
> >                          <goals>
> >                              <goal>check</goal>
> >                          </goals>
> >                          <configuration>
> >                              <haltOnFailure>true</haltOnFailure>
> >
> <dataFile>${project.build.directory}/coverage.exec</dataFile>
> >                              <rules>
> >                                  <rule>
> >                                      <element>BUNDLE</element>
> >                                      <limits>
> >                                          <limit>
> >
> <counter>INSTRUCTION</counter>
> >                                              <value>COVEREDRATIO</value>
> >                                              <minimum>0.80</minimum>
> >                                          </limit>
> >                                      </limits>
> >                                  </rule>
> >                                  <rule>
> >                                      <element>CLASS</element>
> >                                      <limits>
> >                                          <limit>
> >
> <counter>INSTRUCTION</counter>
> >                                              <value>COVEREDRATIO</value>
> >                                              <minimum>0.80</minimum>
> >                                          </limit>
> >                                      </limits>
> >                                  </rule>
> >                              </rules>
> >                              <excludes>
> >                                  <!-- private enum; cannot test valueOf
> / values -->
> >
>  <exclude>**/SocialMediaHelperImpl$WebsiteMetadata$Type.class</exclude>
> >                              </excludes>
> >                          </configuration>
> >                      </execution>
> >                      <execution>
> >                          <id>report</id>
> >                          <phase>prepare-package</phase>
> >                          <goals>
> >                              <goal>report</goal>
> >                          </goals>
> >                          <configuration>
> >
> <dataFile>${project.build.directory}/coverage.exec</dataFile>
> >                          </configuration>
> >                      </execution>
> >                  </executions>
> >              </plugin>
> >              <plugin>
> >                  <groupId>org.apache.maven.plugins</groupId>
> >                  <artifactId>maven-surefire-plugin</artifactId>
> >                  <configuration>
> >                      <systemPropertyVariables>
> >
> <jacoco-agent.destfile>${project.build.directory}/coverage.exec</jacoco-agent.destfile>
> >                      </systemPropertyVariables>
> >                  </configuration>
> >              </plugin>
> >
> > And we also use the agent:
> >
> > <dependency>
> >      <groupId>org.jacoco</groupId>
> >      <artifactId>org.jacoco.agent</artifactId>
> >      <version>${jacoco.version}</version>
> >      <classifier>runtime</classifier>
> >      <scope>test</scope>
> >   </dependency>
> >
> > Thanks,
> > Radu
> >
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "JaCoCo and EclEmma Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jacoco/jX_g_0r-sZE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jacoco/d298e8a7-6bd9-7659-26ad-b90d97767cf7%40mountainminds.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/CAFkwx-c0i%3Dq6U%3DnQ1d7X4nhcLQvWnDg1TJ_mN5YyJ5_udRSk9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to