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. Commented Jun 19, 2017 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. Commented Jun 19, 2017 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
    Commented Jun 19, 2017 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
    Commented Jun 19, 2017 at 13:09
  • @DerekF I am running exactly the same set of test classes in prod and in sandboxes
    – Lance Shi
    Commented Jun 20, 2017 at 23:14

1 Answer 1


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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .