Deploying Apex to a Sandbox Organization

Sandboxes create copies of your Salesforce org in separate environments. Use them for development, testing, and training without compromising the data and applications in your production org. Sandboxes are isolated from your production org, so operations that you perform in your sandboxes don’t affect your production org.

To deploy Apex from a local project in the Salesforce extension for Visual Studio Code to a Salesforce organization, see Salesforce Extensions for Visual Studio Code.

You can also use the deploy() Metadata API call to deploy your Apex from a developer organization to a sandbox organization.

A useful API call is runTests(). In a development or sandbox organization, you can run the unit tests for a specific class, a list of classes, or a namespace.

You can also use Salesforce CLI. See Develop Against Any Org for details.

For more information, see Deploying Apex.