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
penchala rajupenchala raju 

1.How to write test class for custom Setting values

You don't need test classes for custom settings, however if you need to use custom settings in your code that you are testing, you can just insert them like any other sObject.
I think, it is mandetory to create custom settings in test classes wherever you use them as while doing deployments; you new envirnment is not always setup with custom settings all the time or values might change in those custom setting which can make things inconsistent.

How to create:
private class MyTestClass {

    //Initialize custom settings to prevent test failures
    private static Setting__c settingsInstance;
    static {
		settingsInstance = new Setting__c();
		settingsInstance.Field1__c = TRUE;
		settingsInstance.Field2__c = FALSE;
		upsert settingsInstance;
	static testMethod void TestSAPAddressCheck() {		
		//Your unit test here

Hope this helps! Mark it as solution if this solves your problem.