0

The unit test class got 80% test coverage in sandbox. But when deploying into Prod, the validation says that class get only 63% test coverage - so the deployment failed, as we are using Run Specified tests for the deployment validation.

Since the target class is huge, being able to see which lines are covered can be greatly helpful. But I am not sure how in this situation.

  • I wonder if turning on debug logging for the user deploying the code will show the test logs. That might help see if the test is running into an error. – IllusiveBrian Jun 19 '17 at 3:25
  • I usually check each class coverage in Dev. console by double clicking each and every class (under test tab) being shipped in change-set. I hope you have done this already. – Pasan Eeriyagama Jun 19 '17 at 4:32
  • @PasanEeriyagama Thanks for that. But please note that I need the test coverage during deployment time - not in normal test case running - as they have different coverage rate. – Lance Shi Jun 19 '17 at 5:21
  • Sounds to me like you have other tests (besides the ones you're specifying to be run in the deployment) that are contributing to coverage for your target class. Along the same lines as Pasan Eeriyagama has suggested, have you tried opening your target class in the dev console to see exactly which test classes are contributing to your coverage (and are you running all of them in your deployment)? – Derek F Jun 19 '17 at 13:09
  • @DerekF I am running exactly the same set of test classes in prod and in sandboxes – Lance Shi Jun 20 '17 at 23:14
0

Try Using Code Coverage Calculator google chrome extension offered by Sumit Bhatt. This shows the lines of code covered by test class

 Code Coverage Calculator

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.