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

Testing Roll-up Summary Update Trigger
Obj A has a m-d to child Obj B. On Obj A there is a roll-up summary field bSUM which sums up all field b's in all Obj B children. When the r.u.s filed bSUM updates (recalculates) a trigger is fired on Obj A. Now, this all works when I do actual record creation. But in my unit tests, the SOQL and asserts are getting called before the bSUM has updated, which means no trigger was fired yet and therefore the asserts fail. Anybody know what I can do to delay the assertions until the trigger has fired? My apologies if this post is not formatted properly. For some odd reason I no longer get the rich text editor.
Hi,
I don’t think you have to bother about the child record since you have written the trigger on Parent Object. So you have to make the data in such a way that it fits the condition which you have used inside the trigger. Try the below code as reference:
@isTest
private class testTriggerinsert_Contact_Activity
{
public static testMethod void unitTestinsert_Contact_Activity4Task()
{
ParentObject__c p=new ParentObject__c(name='test',othere mendatory fields);
insert p;
update p;
}
}
Even if you have any issue the please post your trigger code.
So what I think I'll do is fake the C record created from the A update trigger in the C trigger test class. Then I'll have to deal with the A update when I revise the A trigger test code.