Newer Version Available
Deploying Apex to a Sandbox Organization
To deploy Apex from a local project in the Force.com IDE to a Salesforce organization, use the Component Deployment Wizard. For more information, see Force.com IDE.
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.
Salesforce includes the Ant Migration Tool that allows you to issue these commands in a console window, or your can implement your own deployment code.
For more information, see Using the Ant Migration Tool and Deploying Apex.