Not showing code coverage report

176 views
Skip to first unread message

shantano...@gmail.com

unread,
Jun 4, 2015, 11:59:57 AM6/4/15
to jac...@googlegroups.com
Below is my maven configuration.

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18</version>
<configuration>
<!-- Sets the VM argument line used when unit tests are run. -->
<argLine>-Xms512m -Xmx1024m -XX:MaxPermSize=512m ${jacoco.agent.argLine}</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
<configuration>
<dataFile>target/jacoco.exec</dataFile>
</configuration>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>jacoco.agent.argLine</propertyName>
<destFile>target/jacoco.exec</destFile>
</configuration>
</execution>
<execution>
<id>default-report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>



When I run using maven

i.e. clean test

after this it creates the jacoco.exec file then I run

jacoco:report and it generates the resport but for except one package for all other it shows 0% code coverage which is not the case. when I run the same report using cobertura it shows non 0% code coverage for those packages.

Any Idea what is wrong here.

Thanks
Shantanoo K

Evgeny Mandrikov

unread,
Jun 6, 2015, 5:08:05 PM6/6/15
to jac...@googlegroups.com, shantano...@gmail.com, shantano...@gmail.com
Hi Shantanoo,

Some questions in order to help you investigate the issue:
  • Are those packages located in the same module?
  • Could you provide some screenshots demonstrating problem?
  • Do you confirm that classes from those packages are available in "target/classes" directory, when "jacoco:report" is executed?
Best regards,
Evgeny Mandrikov

SHANTANOO KIRTANE

unread,
Jun 8, 2015, 2:19:37 PM6/8/15
to Evgeny Mandrikov, jac...@googlegroups.com
Hi

Please find my answers below.



On 6 June 2015 at 17:08, Evgeny Mandrikov <mand...@gmail.com> wrote:
Hi Shantanoo,

Some questions in order to help you investigate the issue:
  • Are those packages located in the same module?
[Shantanoo] Yes
  • Could you provide some screenshots demonstrating problem?
[Shantanoo] Which screen shots are you interested in? the report page
  • Do you confirm that classes from those packages are available in "target/classes" directory, when "jacoco:report" is executed?
[Shantanoo] Yes



--
Thanks & Regards,
Shantanoo Kirtane

Evgeny Mandrikov

unread,
Jun 8, 2015, 2:27:07 PM6/8/15
to jac...@googlegroups.com, shantano...@gmail.com, shantano...@gmail.com
Hi,

Yes, the report page, and especially info about classes from sessions page - see http://www.eclemma.org/jacoco/trunk/coverage/.sessions.html as example.

SHANTANOO KIRTANE

unread,
Jun 8, 2015, 3:00:30 PM6/8/15
to Evgeny Mandrikov, jacoco
Hi

Attaching the data for your reference.

Note: Just unzip the file and put it in same folder as this .html
.sessions.html
index.html
.resources.zip

Evgeny Mandrikov

unread,
Jun 8, 2015, 4:17:13 PM6/8/15
to jac...@googlegroups.com, shantano...@gmail.com, shantano...@gmail.com
If we'll take as an example package "com.wdpr.payment.delegate", then according to "sessions.html" it wasn't seen by JaCoCo agent during execution.

Possible reason for that - seems that you're using PowerMock and known that it doesn't play well with online instrumentation performed by JaCoCo. I didn't played enough with PowerMock to say for sure, but suspect that offline instrumentation might help, there also some mentions of this in internet.

For an example of configuration for offline instrumentation consult with documentation - http://www.eclemma.org/jacoco/trunk/doc/index.html

Don't hesitate to report back if this helped or not.

Best regards

On Monday, June 8, 2015 at 9:00:30 PM UTC+2, SHANTANOO KIRTANE wrote:
Hi

Attaching the data for your reference.

Note: Just unzip the file and put it in same folder as this .html

SHANTANOO KIRTANE

unread,
Jun 9, 2015, 12:01:56 PM6/9/15
to Evgeny Mandrikov, jacoco
Hi

You were right... there is a issue with powemock, PFA pom snippet which worked for me. we added the instrumentation goal and exclude closure classes etc.

I am running it as mvn clean verify install

Thanks
Shantanoo Kirtane
pom_snippet.xml
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages