Regarding Run-All-Tests and the difference in test execution when deploying to Sandbox vs. production
|Knowledge Article Number||000003620|
|Description||The following are some Q&A regarding the Run-All-Tests flag and differences in test execution when deploying to sandbox vs. production|
|Resolution||1. Do run-all-tests execute in production when deploying regardless of what you're deploying?
- No, some components deployed alone won't trigger tests. This document in the metadata API describes which component will invoke validation:
2. Does "run-all-tests" includes running managed package tests?
3. Is there a way to exclude running managed package tests when deploying or is it only possible to ignore the errors generated by these?
- Managed package tests will not be executed when deploying to production, unless you are deploying a managed package.
4. Does code coverage for managed packages test classes contribute to the overall org code coverage?
- The code coverage value computed by "Calculate your organization's code coverage" may differ from the code coverage value computed after running all unit tests using Run All Tests. This is because "Calculate your organization's code coverage" excludes classes that are part of installed managed packages while Run All Tests doesn't.
5. What is the result of setting the runAllTests flag to true in production vs. in sandbox?
- runAllTests is a boolean parameter causing the following behavior:
In Production - if set to false, then managed package tests will not run but every other test will run.
In Sandbox - if set to false, no tests will run.