• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Code Coverage Tool : java

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

My team owns ecommerce sites as well as few other sites which are build on java/j2ee platform. These applications are working perfectly fine and in production. Currently client came to us and ask for generate a report for code coverage. His idea of this report is to see what all line of code is unused. We have a separate testing team who does the manual functional testing and automated load testing.

Is there any tool available using which i can generate such report? We want minimal or no code change in our application that means build the code with the tool and then testing team will execute their test cases and at the end of the test cycle this tool should be able to generate a report with all the unused code.

Hope for a quick reply.

-Mukesh
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out Emma... It is a code coverage tool that instruments Java classes (does not require code changes).

Here's an introductory article with examples using Ant and Tomcat

http://ociweb.com/jnb/jnbFeb2007.html
 
author & internet detective
Posts: 42148
937
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mukesh,
Welcome to JavaRanch!

I second the recommendation of Emma. Do note that this is finding you untested code, not unused code. For example, your catch blocks are unlikely to show up as tested through what the test team is doing since this is a failure case. However this code is potentially used and important to have in production. True unused code is code that cannot be called.
 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try Cobertura - Cobertura is a free Java tool that calculates the percentage of code accessed by tests. It can be used to identify which parts of your Java program are lacking test coverage. It is based on jcoverage.

http://cobertura.sourceforge.net/
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also prefer Cobertura these days. Largely because it's got prettier reports than EMMA
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic