• 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

Code coverage by individual test case

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

Is there any way to find out code coverage when each of my JUnit test case is ran.

The code coverage I get is the result of running all test cases. I want my JUnit test case for a class tests all the code in the class.

Currently I have to instrument single class at a time and run the test case for that class.

Regards,
Nandu
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nandu,


Is there any way to find out code coverage when each of my JUnit test case is ran.


I assume when you say code coverage, you are taking about test coverage which tells you that whether all you code are covered under your Junit test cases.
Clover is one good tool for this. You can integrate it with your IDE and see the test coverage at class level, package level and project level.
Check the URL for more details
Clover
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Take a look at http://hansel.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
...or my old article from 2004:
Introduction to Code Coverage
 
Nandu Jawale
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks to you all. After reading these documents, manuals and FAQs, I think I was rather over-empasizing the code coverage.
I was initially thinking that a test case for a class should test all features of the class. But it seems the collection of test cases should test all features of all the classes.

Thanks again and best regards,
Nandu
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic