1

All my apex classes have more than 90% code coverage. But, when I am trying to deploy them, it is showing I have 59% code coverage. How to solve this issue.

I have run all test, & check all apex classes which I am trying to deploy. All those have >90% code coverage. code coverage If code coverage = average of all individual coverage, my code coverage is supposed to be about 90% but it is showing 59% only.

10
  • 3
    Production environment and Sandbox environment can have some differences. For tests, the good pratices are to not set the SeeAllData to true. Also, don't put try catch in your tests. Maybe an error is raised but you can't see it on deployment. Commented Jan 26, 2017 at 8:37
  • Check this issue.
    – Raul
    Commented Jan 26, 2017 at 8:40
  • Do you have test classes specifically covering the code you are deploying? And do these test classes cover more than 75% of code you are trying to deploy? If answer for both questions is yes, during deployment you have option to run specific test where you can select this new test class and you should be able to deploy your new code. And as good practice, it is always advisable to maintain org level code coverage above 75% and run all tests during deployment
    – sf_user
    Commented Jan 26, 2017 at 8:41
  • " during deployment you have option to run specific test where you can select this new test class and you should be able to deploy your new code."
    – Tanmoy Das
    Commented Jan 26, 2017 at 8:44
  • How can I run specific test?
    – Tanmoy Das
    Commented Jan 26, 2017 at 8:44

0

You must log in to answer this question.

Browse other questions tagged .