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.

  • 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. – Martin Lezer Jan 26 '17 at 8:37
  • Check this issue. – Raul Jan 26 '17 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 Jan 26 '17 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 Jan 26 '17 at 8:44
  • How can I run specific test? – tanmoy Jan 26 '17 at 8:44

Your Answer

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

Browse other questions tagged or ask your own question.