You need to sign in to do that
Don't have an account?
Unit Test Code Coverage and Managed Packages
We get lots of questions on code coverage and deployment and how those are impacted by managed packages (and managed package unit test failures). I was hoping that someone at SFDC could confirm/explain that managed packages are not considered as part of your code coverage percentage for deployment or on the Apex Classes page (where you click the code coverage link to calculate your org's coverage) and that managed package unit test failures will not prevent customer code from deploying to production (unless they've explicitly added the runAllTests="true" option in ant deployment).
I'd like to have a good authoritative response from an internal SFDC development resource to send to customers as they quite frequently get different answers on this issue when asking SFDC support. I'm not looking for a huge response, just a basic explanation and confirmation that managed packages are no longer part of the equation when it comes to customer code.
Here are some resources I've found that give a brief mention that managed packages are not considered when calculating code coverage:
http://na5.salesforce.com/help/doc/en/code_run_tests.htm
Note this statement:
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 record. This should lead to 75% or more of your code being covered by unit tests.
My comment: Your organization namespace doesn't include managed packages as each managed package has it's own namespace.
Also: https://na5.salesforce.com/help/doc/en/code_manage_packages.htm
Specifically this note near the bottom:
The code coverage value computed by Calculate your organization's code coverage might differ from the code coverage value computed after running all unit tests using Run All Tests. This is becauseCalculate your organization's code coverage excludes classes that are part of installed managed packages while Run All Tests doesn't.
Thanks,
Hi EJ:
Thanks,
Josh
All Answers
Still hoping to get a response from SFDC on this.
Could I please get a response from Salesforce.com developer support?
Thanks,
Hi EJ:
Thanks,
Josh
Thanks for the response Josh, I appreciate it. I'll pass this information along to our customers.