Apex Test Run While Deploying

The Test Level deploy options are the followings:

  • Run No Tests - No Apex test are run unless it is production deployment.

When deploying to production, Salesforce does not allow No Test Run, and it will force a Run Local Tests. Also, when deploying to production, it is possible to use the option Run Specified Tests. However, in order to benefit from this option, you will need to include in the same step altogether with the Apex classes and the Apex test classes which must provide at least 75% of coverage of the code being deployed.

  • Run Specified Tests - This option allows you to determine which tests you specifically want to run. This is great for deployments to staging sandboxes and provides you with the most control possible.

  • Run Local Tests - This option will run all tests in your organization except ones that originate from installed managed packages. This test level is the default for production deployments that include Apex classes or triggers. This is a great option to run tests that you’ve written, and which are under your control but ignoring those that may come with managed packages or installed apps. It can be a big time and frustration saver.

  • Run All Tests in Org - This option runs all tests in your Salesforce org, including third-party tests from managed packages.

  • Specified and Package Test - In this test level option, the system will intelligently identify and include all the test classes located within the package. In addition to this automatic selection, you will also have the flexibility to manually choose specific test classes that may not be part of the package.
    This option ensures comprehensive test coverage by accommodating both package-based and individually selected test classes in your testing process.

Note - If you want to proceed with Specified and Package Tests, first make any desired changes to your package files, such as resequencing files or adding/removing files. After that, select the test level.
If you initially select the test level and then make changes to the file sequence or add/remove files, it could result in a deployment failure.


Reference screenshot is here:

 

The following macros are not currently supported in the footer:
  • style