• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cobertura code coverage issue

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

We are using sonar in our project. Sonar by default uses cobertura for determining code coverage. My application is divided into multiple projects and each of them having their own pom.xml files. So as I understand, the cobertura stats will also be calculated on per project basis.

My pom.xml has following config
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.4</version>
</plugin>

The problem that I am facing is I have a JUnit test class in project A which calls and tests certain classes in project B. However, when I look at the cobertura report for project B, it shows 0% line coverage. Coverage report for project A anyways would not contain the details about project B. Is there some configuration required for getting the correct code coverage?

I suspected it might be due to cobertura instrument details not getting merged correctly hence I tried adding the following in the pom.xml files of project A & B but still the results were no different.

<cobertura-merge>
<fileset dir="${basedir}">
<include name="**/cobertura.ser" />
</fileset>
</cobertura-merge>

In any case, I think Sonar should be smart enough to merge the results. Any specific configuration changes that I might need to make in order to get the correct code coverage figures?
This is important for us because we do not want to lag behind the other teams who are faring much better code coverage. We know that a lot of code has been covered via unit and integration testing classes but don't have the numbers to prove it!

Has anyone faced similar issue in the past?

Thanks,
Miten
 
reply
    Bookmark Topic Watch Topic
  • New Topic