function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mubarak Hussain 1Mubarak Hussain 1 

How to add list of custom setting in Testclass

Hi all,
How to add list of custom settings in testclass??
for ex.i am having custom setting as custom_settting_1 .
i created a list by
list<Custom_setting_1> sc= new list<custom_setting_1>();

Is there any way to include the list of custom setting.?
Without list am getting 100%code coverage.but with list my code coverage got decreased.
 
Andries.NeyensAndries.Neyens
you can create custom settings just the same as other sObjects,
so a insert new custom_setting_1(<the properties you need>) should work.
Amit Chaudhary 8Amit Chaudhary 8
You can create the customsetting data same like the custome object.
for exmpl

custom_setting__C obj= new custom_setting__C ();
obj.fieldName ='value';
insert obj.

Please let us know if this will help u
Thanks
Amit Chaudhary