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
stevedotstevedot 

Deploying Unit Test also failed with message "at least 75% test coverage is required."

At first, deploying Apex failed with the message "Average test coverage across all Apex Classes and Triggers is 74%, at least 75% test coverage is required."

So i try to up the test coverage % by deploying only Unit Test , but the Unit Test deployment also failed with message "Average test coverage across all Apex Classes and Triggers is 74%, at least 75% test coverage is required."

How am i going to up the test coverage % when SF won't allow me to deploy Unit Test?
SFDC_DevloperSFDC_Devloper
Hi,

If you are deploying all class then there will be no problem with the test coverage as the whole organization has atleast 75% test coverage. when you are trying to deploy a individual class (each class 75% test coverage is required)if that class doenot has the 75% test coverage then it will be problem for deployment.

Please go throught the below URL for more details.

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_testing_best_practices.htm

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_deploying_ant_deploy.htm

   [If it helps, mark it as "Best Answer"]


Thanks,
Rockzz
stevedotstevedot
Hi Rockzz,

But now i'm just trying to deploy Unit Test @isTest and it still failed with test coverage 75% required.

How can i bring up the test coverage to at least 75% when SF won't even allow me deploy Unit Test?

Thanks
SFDC_DevloperSFDC_Devloper
Hi,

   Use the @isTest(SeeAllData=true)

@isTest(SeeAllData=true)


[If it helps, mark it as "Best Answer"]


Thanks,
Rockzz
stevedotstevedot
hi Rockzz,

this is my test unit i'm trying to deploy, even this alone failed with "at least 75% test coverage is required."


@isTest(SeeAllData=true)
private class testrunFRWCaseReporting {
static testMethod void runFRWCaseReporting_testmethod(){
  Test.startTest();
  runFRWCaseReporting rcr = new runFRWCaseReporting();
  SchedulableContext sc;
  rcr.execute(sc);
  Test.stopTest();
}
}
SFDC_DevloperSFDC_Devloper
Hi,

  Create test data in your test class based your  controller and suppose your using Lead object in controller create test data for Lead object check below code.Finally call your controller method in your test class. 
Lead lead1= new Lead();
    lead1.Company='Lead23';
    lead1.LastName='Test1234';
    lead1.Status='Closed';
    lead1.Lead_Intel__c='Intelligence';
insert lead1;

Thanks,
Rockzz 
stevedotstevedot
Endless retry on deploying the same Unit Test, and what do you know, suddenly the deployment was a success.