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

After Update Timing issue with Test Class
Greetings !
Wondering how to solve what I think is just a timing issue..
I have an "After Update" trigger that inserts records into a child object.
Seems to work fine when run and inspected by human eyes, however, in my test class, I think I'm running into an issue where my "after update" hasn't quite finished yet.
How can I ensure the trigger has finished processing before my "assertEquals" checks in my test class?
Thanks,
Pete
Hi,
In your test class do an Update DML statement like insert, So that after update event will get fire and code will be covered.
Thanks,
kodisana
wrap the update statement in the test class in a test.start/test.stop sequence. When the test sees stoptest(), it runs all actions including after updates and workflows, and then when you query for the object, it should be correct:
e.g.