Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Code coverage by individual test case

 
Nandu Jawale
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • 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
 
Manoj Kumkumath
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • 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
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at http://hansel.sourceforge.net/
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic