Before we can deploy the Apex Controller class AccountSearchController, which we created in the Developing an Apex Controller to search for accounts recipe, to the production environment, at least 75% of the Apex code must be covered by unit tests, and all of those tests must complete successfully.
Writing unit tests for Apex code is a necessary activity when developing code in the Salesforce platform, and a mandatory requirement before you are able to deploy the code into a Salesforce production environment.
The purpose of the unit tests is to ensure that 75% of the lines of code, as a minimum, have been covered by the unit tests. You should, however, strive to write unit tests that cover every logical path of your code, including any error handling, to achieve 100% code coverage.