Newer Version Available

This content describes an older version of this product. View Latest

Using the Salesforce Extensions for Visual Studio Code to Deploy Apex

Salesforce Extensions for Visual Studio Code includes tools for developing on the Salesforce platform in the lightweight, extensible VS Code editor. These tools provide features for working with development orgs (scratch orgs, sandboxes, and DE orgs), Apex, Lightning components, and Visualforce.

If you deploy to a production organization:

  • Unit tests must cover at least 75% of your Apex code, and all of those tests must complete successfully.
  • Every trigger must have some test coverage.
  • All classes and triggers must compile successfully.

Note the following.

  • When deploying Apex to a production organization, each unit test in your organization namespace is executed by default.
  • Calls to System.debug aren’t counted as part of Apex code coverage.
  • Test methods and test classes aren’t counted as part of Apex code coverage.
  • While only 75% of your Apex code must be covered by tests, don’t focus on the percentage of code that is covered. Instead, make sure that every use case of your application is covered, including positive and negative cases, as well as bulk and single records. This approach ensures that 75% or more of your code is covered by unit tests.

Note

For more information on how to deploy to a Salesforce org with Visual Studio Code, see Development Models.