How do I deploy code from Sandbox to Production?
Knowledge Article Number: 000005283
You cannot develop Apex in your Salesforce.com production organization. Live
users accessing the system while you are developing can destabilize your data or
corrupt your application. Instead, salesforce.com recommends that you do all
your development work in either a sandbox or a Developer Edition organization.
To deploy code from a Sandbox or Developer Edition org to Production, you will need to use either the Force.com Migration Tool or the Force.com IDE.
Note: If you deploy to a production organization, 75% of your Apex scripts must be covered by unit tests, and all of those tests must complete successfully.
While only 75% of your Apex code must be covered by tests, your focus shouldn't be on the percentage of code that is covered. Instead, you should make sure that every use case of your application is covered, including positive and negative cases, as well as bulk and single record. This should lead to 75% or more of your code being covered by unit tests.
Force.com Migration Tool
The Force.com Migration Tool is a Java/Ant-based command-line utility for moving metadata between a local directory and a Force.com organization.
The Force.com IDE is a powerful client application for creating, modifying and deploying Force.com applications. Based on the Eclipse platform, it provides a comfortable environment for programmers familiar with integrated development environments, allowing you to code, compile, test, package and deploy all from within the IDE itself. Much of the actual work, such as compilation, happens on the Force.com platform—the Force.com IDE performs the communication and result parsing transparently.
Please refer to the Apex Language Reference Documentation for more information
See the chapter on Deploying Apex Scripts