You need to sign in to do that
Don't have an account?
saad mechiche alami
Create custom settings for a unit test
hello,
I need to create a custom setting for my unit test
the custom setting object name is called Terms_of_Use
how can i program that ?
many thanks
I need to create a custom setting for my unit test
the custom setting object name is called Terms_of_Use
how can i program that ?
many thanks
Terms_of_Use__c testRecord = new Terms_of_Use__c(field values);
insert testRecord;
All Answers
Terms_of_Use__c testRecord = new Terms_of_Use__c(field values);
insert testRecord;
You can create a custom setting just like you createa standard or custom objects in your test methods. Please see this if you need some further help: http://salesforce.stackexchange.com/questions/3565/how-to-access-custom-settings-in-test-class-without-using-the-seealldata
If this answers your question, please mark this as the Best Answer for this post, so that others can benefit from this post.
Thanks,
Shashank
For inserting List Custom Setting,
For inserting Hierarchy Custom Setting,
You can also insert a test user record or profile and assign those id in SetupOwnerID for hierarchy custom setting..
Thanks,
Arunkumar R