You need to sign in to do that
Don't have an account?

Is there any special way to cover the Class Catch Exception in test coverage...
Hi,
In some of the classes the (exceptions) Catch part are covered in test coverage and in some cases its not covering the catch exception in test code. Is there any special way to cover the catch part in test code..
Thanks in advance...
Natraj..
Nothing much to worry. Catch code is simple code which we can cover as we do for our normal code. For example I have written a code in which I am passing an integer value which is used to do some calculation. In try part I have written the logic and in catch part I have written system debug.
Now your test cases should cover two scenarios, first will contain the valid value which will cover try part and other will have invalid value which will generate error in my calculation that will cover my catch part.
Hope it will help
Thanks
Ankit Arora
Blog | Facebook | Blog Page
Hi Ankit,
In this case,What will happen when you set string value and the compiler itself throw a error meaning catch block will not cover.
Muruganand