Since API 24, you cannot use existing Salesforce data in your test classes until you set SeeAllData to true. (http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_testing_data_access.htm)
Hence you would require data in Custom Settings too to be available to your code. Creating a new record for Custom Settings is also same as that for any other Standard or Custom Object.
Hence you would require data in Custom Settings too to be available to your code. Creating a new record for Custom Settings is also same as that for any other Standard or Custom Object.
Custom_Settings__c cs = new Custom_Settings__c (Name='Owner_Name', Value__c='HS');
insert cs;
insert cs;
What about List custom settings, any idea how to create them?
ReplyDeleteThis code is for the List custom settings only.
ReplyDeleteI get an error saying "Invalid type: Custom_Settings__c".
ReplyDelete