Activity Forums Salesforce® Discussions How can I get the custom setting in the salesforce apex test class?

  • Vikas Kumar

    Member
    January 18, 2017 at 1:44 pm

    Hi Mohit,

    Declare your method with the @isTest(SeeAllData=true) that way your testmethod has visility over the data in your database, outside of the test context.

     

  • Liron

    Member
    March 7, 2017 at 9:54 am

    Using @isTest(SeeAllData=true) is baa practice, as data may be different in each environment, and therefore the test behavior will be different.

     

    You should create all the require data in the test class. Custom Setting data can be created as any other Object records

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos