You need to sign in to do that
Don't have an account?
Suraj Demgunde
i want to write test class on below trigger plz help me
trigger Lead_Update on Lead (before insert,before update) {
String dam ='';
String jub='';
String west1 ='';
String west2 = '';
String central = '';
String Gcc = '';
for(Lead lt : trigger.new){
if(String.isNotBlank(lt.Dammam__c)){
dam = 'Dammam\n';
}
if(String.isNotBlank(lt.Jubail__c)){
jub = 'Jubail\n';
}
if(String.isNotBlank(lt.West_North__c)){
west1 = 'West North\n';
}
if(String.isNotBlank(lt.West_South__c)){
west2 = 'West South\n';
}
if(String.isNotBlank(lt.Central_Region__c)){
central = 'Central\n';
}
If(String.isNotBlank(lt.GCC__c)){
Gcc = 'GCC';
}
lt.Region__c = dam+ jub+ west1+west2 +central +Gcc;
}
}
String dam ='';
String jub='';
String west1 ='';
String west2 = '';
String central = '';
String Gcc = '';
for(Lead lt : trigger.new){
if(String.isNotBlank(lt.Dammam__c)){
dam = 'Dammam\n';
}
if(String.isNotBlank(lt.Jubail__c)){
jub = 'Jubail\n';
}
if(String.isNotBlank(lt.West_North__c)){
west1 = 'West North\n';
}
if(String.isNotBlank(lt.West_South__c)){
west2 = 'West South\n';
}
if(String.isNotBlank(lt.Central_Region__c)){
central = 'Central\n';
}
If(String.isNotBlank(lt.GCC__c)){
Gcc = 'GCC';
}
lt.Region__c = dam+ jub+ west1+west2 +central +Gcc;
}
}
Class CaseUpdater : Method does not exist or incorrect signature: void isRunningTest() from the type test this error shown
Let us know if this will help you
I never recommend having a test method without having assertion as this will always make it pass even the test method is failing. It is a not a best practise. But it is up to you what you speard.
@Suraj
Regarding having a value 1, you can choose anything you want. I just made it as you code was looking !ISBLANK, so you need something to make that true.
Regarding the issue with Dependent class you are sharing above, it seems like you need to check that class and properly save it. I don't think it has to do with this until you are doing anthing at the lead trigger level of calling that class for some reason. You just need making sure that class ClassUpdater compile without issues.