Optimized Installation

Attribute
Type
Description
Package Types Applicable

isOptimizedDeployment

boolean

Detects test classes in a source package automatically and utilise it to deploy the provided package

  • source

  • diff

sfp cli optimally deploys artifacts to the target organisation by reducing the time spent on running Apex tests where possible. This section explains how this optimisation works for different package types.

Package Type
Apex Test Execution during installation
Coverage Requirement

Unlocked Package

No

75% for the contents of a package validated during build

Org Dependent Unlocked Package

No

No

Source Package

Yes

Yes, either each classes need to have individual 75% coverage or use the entire org's apex test coverage

Diff Package

Yes

Yes, either each classes need to have individual 75% coverage or use the entire org's coverage

Data Package

No

No

To ensure salesforce deployment requirements for source packages, each Apex class within the source package must achieve a minimum of 75% test coverage. This coverage must be verified individually for each class. It's imperative that the test classes responsible for this coverage are included within the same package.

During the artifact preparation phase, sfp cli will automatically identify Apex test classes included within the package. These identified test classes will then be utilised at the time of installation to verify that the test coverage requirement is met for each Apex class, ensuring compliance with Salesforce's deployment standards. When there are circumstances, where individual coverage cannot be achieved by the apex classes within a package, one can disable 'optimized deployment' feature by using the attribute mentioned below.

This option is only applicable to source/diff packages. Disabling this option will trigger the entire local tests in the org and can lead to considerable delays

// Demonstrating how to disable optimized deployment
{
  "packageDirectories": [
    {
      "path": "core-crm",
      "package": "core-crm",
      "versionDescription": "Package containing core schema and classes",
      "versionNumber": "4.7.0.NEXT",
      "": false
    },
     ...
   ]
}

Last updated