Loading

FAQ on test execution when 'Run-All Tests' flag is deployed

Data pubblicazione: May 29, 2026
Descrizione

The runAllTests flag is a boolean parameter in the Salesforce Metadata API deployment process that controls which Apex tests run during a metadata deployment. Its behavior differs between Production and Sandbox environments, and it interacts with managed package tests in non-obvious ways. The following FAQ answers the most common questions about runAllTests behavior.

Risoluzione

Does runAllTests execute tests in production when deploying, regardless of what you're deploying?

No. Some components deployed alone do not trigger test execution. The Salesforce Metadata API documentation on "Running Tests in a Deployment" describes which component types invoke validation and test execution during deployment.

Does runAllTests include running managed package tests?

Yes. When the runAllTests flag is set to true, managed package tests are included in the test run along with all other tests in the org.

Can managed package tests be excluded when deploying to production?

Managed package tests are not executed when deploying to production unless you are specifically deploying a managed package. In a standard non-package deployment, managed package tests do not run.

Does code coverage for managed package test classes contribute to overall org code coverage?

The code coverage value computed by "Calculate your organization's code coverage" may differ from the coverage computed after running all 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 does not. If your coverage percentages differ between these two methods, this difference in scope is the expected cause.

What is the result of setting runAllTests to true in Production vs. Sandbox?

The runAllTests boolean parameter has different effects depending on the deployment target:
In Production: If runAllTests is set to false, managed package tests do not run, but all other tests (non-managed-package Apex tests) do run to satisfy the deployment code coverage requirement.
In Sandbox: If runAllTests is set to false, no tests run at all. The Sandbox environment does not enforce the code coverage requirement that Production does, so setting runAllTests to false results in zero tests being executed.
Numero articolo Knowledge

000384772

 
Caricamento
Salesforce Help | Article