
Your code coverage is 0%. You need at least 75% coverage to complete this deployment.My Sandbox code coverage shows as below:Code Coverage: 82%
Your overall code coverage is currently 82%. To deploy code to production, you must have at least 75%.Can someone please help me what is wrong with the deployment?
4 risposte

SOLVEDI hear many stories and I believe my story would help someone with this issue: I wrote simple trigger in sanbox
trigger Test_TRG on Account (before insert) {
for(account a :Trigger.New){
a.Consultant__c = 'Test';
}
}
and a test class :
Deployed both together through changesets and it deployed successfully. I assume that the test class deployed with the triggers gets executed for validation and deployes the code if the code is covered in that test. So try to deploy small snipped of code along with the Test class to cover that code and it iwll work. Now my code coverage shows 100% after running the tests in Production Org.@isTest
public class GolarTestProd{
static testmethod void createLead(){
Lead ld = new Lead();
ld.FID__c = '122333';
ld.Facility_Name__c = 'XXXX';
ld.Company= 'Test Company';
ld.firstname = 'FirstName';
ld.lastname = 'lastname';
ld.status = 'New';
insert ld;
ld= [select id, fid__c,name from Lead where fid__c ='122333' ];
System.assertEquals('122333', ld.fid__c);
}
}
I hope this helps others with similar problem.