You need to sign in to do that
Don't have an account?
cvuyyuru
problem with batch Apex.
Hi,
I have two batch apex classes which are schedulable. I wrote test classes to them.
When I test my code coverage, I am getting 100% code coverage.
But when I tried to move these classes to Prod, I am getting test calsses code coverage error.
To my surprise, the batch classes are not covered. 63% coverage.
Then I changed the code and wrote two test classes for two batch classes which are schedulable.
No every class is coverd 100% but the aggregate code coverage is 72%.
Cant know what to do. Suggest me with a best solution
Regards,
Charan
Thanks Ankit, Solved the issue.
No triggers are there. but my TL sorted it for me....
Before, in my test calss I used to instantiate Batchclass and immediately I scheduled the batch class.
Rather than that,
In a test class, he kept two methods.
one method: calling batch apex
second method: calling schedule methos in Batch Apex.
This soled the problem.
Experience matters right!!!
Thanx to my TL.
Regards,
Charan
All Answers
If your batch class contains any DML which calls trigger of any other object, or referring to any class then your aggregate code coverage will decrease. As you may have separate test class for those triggers and referring classes then no need to take care of them in you batch test class.
You must be concerned only with the code coverage of your batch class. If it is more than 75% then you can proceed with deployment.
Thanks
Ankit Arora
Blog | Facebook | Blog Page
Thanks Ankit, Solved the issue.
No triggers are there. but my TL sorted it for me....
Before, in my test calss I used to instantiate Batchclass and immediately I scheduled the batch class.
Rather than that,
In a test class, he kept two methods.
one method: calling batch apex
second method: calling schedule methos in Batch Apex.
This soled the problem.
Experience matters right!!!
Thanx to my TL.
Regards,
Charan