You need to sign in to do that
Don't have an account?
MaheemSam
Code Coverage for blank class
Hi,
I have a class below which has no code I want to get coverage for below class
Please suggest me how to get code coverage.
Thanks
Sudhir
I have a class below which has no code I want to get coverage for below class
public class PP_HandleException extends Exception { }Wrote test class as mentioned blelow. Still showing 0% as code coverage
@isTest(seealldata=false) public class PP_HandleExceptionTest{ static testMethod void PP_HandleException(){ Test.startTest(); PP_HandleException PP = new PP_HandleException('test'); Test.stopTest(); } }
Please suggest me how to get code coverage.
Thanks
Sudhir
You are not calling the method name.
Update ur Class as following -
Update ur test class -
Please try the code below for 100% code coverage:
public class PP_HandleException extends Exception {
public static void exceptionmethod()
{
}
}
Test class:
@istest
public class HandleCodeTest {
static testMethod void PP_HandleException(){
Test.startTest();
PP_HandleException.exceptionmethod();
Test.stopTest();
}
}
The reason you were not able to find code coverage in your code was that of the absence of method
or constructor in your class. Writing a test class for a class without having a method or constructor would be meaningless.
I hope you will find this explanation helpful. Please mark it as best answer if you find it helpful.
Thanks.
Ajay Dubedi