aspose file tools*
The moose likes Testing and the fly likes Code coverage by individual test case Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Code coverage by individual test case" Watch "Code coverage by individual test case" New topic
Author

Code coverage by individual test case

Nandu Jawale
Greenhorn

Joined: Feb 04, 2002
Posts: 22
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

Joined: Dec 01, 2005
Posts: 71
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

Joined: Jul 11, 2001
Posts: 14112
Take a look at http://hansel.sourceforge.net/


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
...or my old article from 2004:
Introduction to Code Coverage


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Nandu Jawale
Greenhorn

Joined: Feb 04, 2002
Posts: 22
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Code coverage by individual test case