+ Start a Discussion
Uday KUday K 

How to skip the validation rules when inserting records in test class

Hi all,

Please,can someone suggest me how to skip the validation rules when only inserting the records but not on Updating,in the test class. Is that Test.LoadData() works out in my case?

Thanks in Advance

You can achieve this by creating a custom field on object involved in testing and add a logic in validation rules that when the checkbox equals TRUE then ALL validations on the OBJECT would be turned off until it's unchecked again. Now while testing set the checkbox to true.