Hi i am trying to merge the custom object trigger from sandbox to production. i follow the steps from this site http://www.sfdc99.com/2013/06/04/how-to-deploy-code-from-sandbox-to-production/
when i click the deploy i will get the following error.
Your organization's code coverage is 2%. You need at least 75% coverage to complete this deployment. Also, the following triggers have 0% code coverage. Each trigger must have at least 1% code coverage.
This is my trigger
trigger LeadAssignmentTrigger on Broker__c (before insert,before update)
{
List<Broker__c > leadsToUpdate = new List<Broker__c >();
for (Broker__c broker: Trigger.new)
{
if (broker.Referral_ID__c!= NULL)
{
String str = broker.Referral_ID__c;
Integer ln = str.Length();
String likeStr = '%'+str.subString(ln-10, ln-7)+'%'+str.subString(ln-7, ln-4) +'%'+ str.subString(ln-4);
// Find the sales rep for the current zip code
List<User> zip = [select Id from User
where MobilePhone Like : likeStr];
// if you found one
if (zip.size() > 0)
{
//assign the lead owner to the zip code owner
broker.OwnerId = zip[0].Id;
leadsToUpdate.add(broker);
}
else
{
// Throw Error
broker.addError('Invalid Referrel ID');
}
}
}
}
and i new to salesforce i don't know how to write test class.
I write the test class,
@isTest
private class LeadAssignmentTriggerTest
{
static testMethod void validateHelloWorld()
{
Broker__c broker = new Broker__c();
//broker.Referral_ID__c = add valid value here
// Add all required field here
broker.Referral_ID__c='5555555555';
broker.City__c='Mumbai';
try
{
insert broker;
}
Catch(Exception ee)
{
}
}
}
But i got the same error.What i did error.