• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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
 
You guys haven't done this much, have ya? I suggest you study this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic