function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rodolfo CalvoRodolfo Calvo 

Issue at creating a Package

If I create a package in salesforce for my app, an error is shown: 
No test methods found in the Apex code included in the package. At least 75% test coverage is required. 

I have more than 2000 lines of code in visualforce page and its controller. This requirement means that I have to re-write all my code??

Thanks in advance.
Derhyk Doggett -Derhyk Doggett -

It means you will need some test coverage on the controller class you wrote.
All the code in your production org will need 75% coverage on average. Meaning, for example, if you have 90% coverage on a vast amount of code already, you can write tests to include some of the controller, and even if its under 75% for the one controller, as long as you are 75% for the org you will pass and be able to deploy.
It is always best practice to provide good test coverage on all code you are deploying to production.

More informaiton on test classes and coverage can be found here:

Hope this helps.


Rodolfo CalvoRodolfo Calvo
I understand, 
Would you please ilustrate me a little more, for example, let me show you a simple sample of code.
public class mainCtrl()
        public String _sTring{get;set;}
        public List<Account> accts;
        public void method()
                //Do something
                accts = [Query];
                //So another thing
        public void methodK()
            //Do something
        public void executeButton()

What's should I do here? 
What would be the process to make my code work?

Thanks a lot. 
In Cloud Computing before going to every class in production environment from sandbox your class has to cover minimum 75% code coverage for that 
@istest  <<<<< method name 
write test class for your code like an example ::if you are updating contract  value 
you have write code for that and assign value for it 

public static void  classname (){
        Contract_c__c cont = new  Contract_c__c();
        cont.Account__c = 'value';
        cont.Source__c = 'value';
        cont.Name = 'value';
        insert cont;


means you have to cover all method in test class