You need to sign in to do that
Don't have an account?
chiranjib rout
hii every one ,how could i write a test class for this trigger ,could any one provide me the test class codes for this trigger
trigger CTC_Update on Appraisal__c (after insert,before update ) { List<appointment__c> AppList = New List<appointment__c>(); Set<Id> AppointIds = New Set<Id>(); For(Appraisal__c A : Trigger.New) { AppointIds.Add(A.ApplicantName__c); } List<appointment__c> AppointList = [Select Id,Current_CTC__c from appointment__c where id =: AppointIds]; For(Appraisal__c Aps : Trigger.New) { appointment__c A = new appointment__c(); For(appointment__c App : AppointList) { IF(Aps.ApplicantName__c == App.ID) { A.Id = App.Id; IF(Aps.amount_of_Increment__c != 0 && Aps.amount_of_Increment__c != NULL) { A.Current_CTC__c = App.Current_CTC__c + Aps.amount_of_Increment__c ; } IF(Aps.Increment_Percentage__c != 0 && Aps.Increment_Percentage__c != NULL) { A.Current_CTC__c = App.Current_CTC__c + (App.Current_CTC__c * Aps.Increment_Percentage__c/100); } } AppList.Add(A); } } IF(AppList != NULL) { Update AppList; } }
Here is a sample of test class:
For more information regarding Test class, refer this link :
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_test.htm
Thanks,
Dhanya
All Answers
Here is a sample of test class:
For more information regarding Test class, refer this link :
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_qs_test.htm
Thanks,
Dhanya