+ Start a Discussion
Paul Fitzpatrick 22Paul Fitzpatrick 22 

Pushing Apex Code Changes from Sandbox to Production using Force.com IDE (Test Code Coverage Contraints Query)

I understand that when 'pushing' Apex code from a Sandbox to Production using the Change Set mechanism, test code coverage must be 75% or greater. Does the same constraint apply when using the Force.com IDE(clicking the 'Deploy to Server' button and selecting Production as the Target Org) to 'push' Apex code changes from a Sandbox to Production? I've used the Force.com IDE to push Apex code changes between Sandboxes with no issues to report. Any help would be appreciated as this is urgent!!!!
Pruthvi KankunthalaPruthvi Kankunthala
@Paul : Yes even while using Force.com IDE for deploying Apex code from Sandbox to Production code coverage is mandatory . Check this article for reference https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_deploying_ide.htm . Mark as best answer if helped . Thanks !!!
Amit Chaudhary 8Amit Chaudhary 8
Yes code coverage is mandatory  for Sandbox to Production production deployment.
You Can try below App Exchange product as well to track the each Apex class code coverage

URL:- https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000DXzlpEAD
Code Coverage Report
Now you can view the overall and individual entity code coverage in your organization. The results of the code coverage can be downloaded in Excel format

Let us know if this will help you
Paul Fitzpatrick 22Paul Fitzpatrick 22
Hi Pruthvi, Yes it answered my question! Many thanks! One more question: would I get an error msg if I tried to deploy code changes between 2 Non-Production Orgs where code coverage %age is less than 75%? Thanks again!
Amit Chaudhary 8Amit Chaudhary 8
For sandbox you will not get code coverage issue. Code coverage issue will come only for production deployment.

Please check below post
1) https://help.salesforce.com/apex/HTViewSolution?id=000187272&language=en_US
2) https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_code_coverage_best_pract.htm
  • At least 75% of your Apex code must be covered by unit tests, and all of those tests must complete successfully. Note the following:
  • When deploying to a production organization, every unit test in your organization namespace is executed.
  • Calls to System.debug are not counted as part of Apex code coverage.
  • Test methods and test classes are not counted as part of Apex code coverage.
  • While only 75% of your Apex code must be covered by tests, your focus shouldn't be on the percentage of code that is covered. Instead, you should make sure that every use case of your application is covered, including positive and negative cases, as well as bulk and single records. This should lead to 75% or more of your code being covered by unit tests.
  • Every trigger must have some test coverage.
  • All classes and triggers must compile successfully.
Paul Fitzpatrick 22Paul Fitzpatrick 22
Many thanks for this, Amit. I'm sure this will come in useful in the near future!