function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
gregsgregs 

Deploying classes to production code coverage question

The apex manual says the following about deploying classes to production:

Understanding deploy
The deploy call completes successfully only if all of the following are true:

• 75% of your Apex scripts are covered by unit tests, and all of those test 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 in unit tests.
• Every trigger has some test coverage.
• All classes and triggers compile successfully.

Question: Doe EACH apex class need to get >75% code coverage or only ALL CLASSES AS A WHOLE?

RickyGRickyG
gregs -

The restriction covers all classes currently being deployed, so it's a 75% average.  But keep in mind that you really should shoot for 100%, for reasons discussed here, among other places.

Hope this helps.