Salesforce Apex: how to test if trigger was called -
i have trigger in apex. how write unit test checks if trigger called?
account account = new account(name='test account'); insert account; checkifinserttriggercalled(); // how implement this?
you should testing trigger does, not if called or not. trigger do?
if trying see if inserted then:
account account = new account(name='test account'); insert account; list<account> alist = [select id, name account]; system.assertequals(1,alist.size());
side note: have left comment, few rep short on site. edit: here standard page gets linked lot: https://developer.salesforce.com/page/how_to_write_good_unit_tests
Comments
Post a Comment