| Author |
How to handle code coverage for catch blocks?
|
Giriraj Bhojak
Ranch Hand
Joined: Apr 03, 2008
Posts: 67
|
|
I am trying to improve code coverage of our enterprise application.
Is there an approved way to handle catch blocks?
How do i increase code coverage by running tests that lets the control go to catch block?
I hope my query is clear enough.
Thanks,
Giriraj.
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26192
|
|
Giriraj,
What tool are you using for code coverage? Different tools handle catch blocks differently.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Giriraj Bhojak
Ranch Hand
Joined: Apr 03, 2008
Posts: 67
|
|
I am using Clover.
Testing each and every catch block is exhaustive and seems improbable to me.
But there has to be way to handle most of the error conditions.
Thanks,
Giriraj.
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26192
|
|
|
One way is to have less catch blocks. Can a filter or superclass handle the common ones?
|
 |
Giriraj Bhojak
Ranch Hand
Joined: Apr 03, 2008
Posts: 67
|
|
That would require refactoring which unfortunately isn't an option for me right now.
I simply have to improve the coverage for existing code base.
What else could you suggest?
Thanks a ton for replying...
Giriraj.
|
 |
 |
|
|
subject: How to handle code coverage for catch blocks?
|
|
|