You need to sign in to do that
Don't have an account?

how to covered the trigger test class because i am facing a problem ? its my Code
hi,
i am faceing a probject for coverage a unit test code please help me ?
trigger on inforamtionManagement on informationManagement__c(After insert) {
for(informationManagement__c infoobj:trigger.new){
if(infoobj.canclae_Event__c== False && infoobj.Target_People__c=='Person'){
Resitration_from__c rsfobj=new Resitration_from__c();
rsfobj.Record_type='new';
rsfobj.Account_Name=infoobj.lead_Name__c;
rsfobj.start_date__c=infoobj.start_date__c;
isnert(rsfobj);
}
}
}
i am faceing a probject for coverage a unit test code please help me ?
trigger on inforamtionManagement on informationManagement__c(After insert) {
for(informationManagement__c infoobj:trigger.new){
if(infoobj.canclae_Event__c== False && infoobj.Target_People__c=='Person'){
Resitration_from__c rsfobj=new Resitration_from__c();
rsfobj.Record_type='new';
rsfobj.Account_Name=infoobj.lead_Name__c;
rsfobj.start_date__c=infoobj.start_date__c;
isnert(rsfobj);
}
}
}
Greetings to you!
Please try the below code.
Also, You have DML inside for loop. You should never do a DML inside of a loop. Change your code to:
Please refer to below links for more information:
https://trailhead.salesforce.com/en/content/learn/modules/apex_testing/apex_testing_triggers
http://www.sfdc99.com/2013/11/02/example-write-a-test-class-for-our-deduping-trigger/
http://amitsalesforce.blogspot.com/2015/06/best-practice-for-test-classes-sample.html
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
its working fine but when i going for (After delete) but its not good work