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
Bhupathi YadavBhupathi Yadav 

Custom label code coverage in test class

I am using few custom labels in in my class i have to cover code coverage for that

            /* fetch required properties from custom labels*/\

            Storefront=System.Label.RLWS_CL_EmbTrack_Storefront;
            LOGO=System.Label.RLWS_CF_Logo;
            UniversalLogo=System.Label.RLWS_CF_Universal_Logo;
            UniversalLogoPrice=System.Label.RLWS_CF_Universal_Logo_Price;
            
            currencies = [Select label from RLWS_Obj_Currency__mdt Limit 100];

Can you please tel how to cover this area
 
bhanu_prakashbhanu_prakash
Hi Bhupathi,
Mark as best answer, If it resloves !!
you can not intialize  custom label value by apex class. For same below idea ia raised. Please vote for same if you need same
1) https://success.salesforce.com/ideaView?id=08730000000DgpGAAS

But you can use the existing custom label value in your test classes.
1) https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_variables_global_label.htm
2) https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_customlabels.htm

resource : https://developer.salesforce.com/forums/?id=9060G000000XfwvQAC

Mark as resloved if it helps :) :)
Thanks, 
Bhanu Prakash
visit ForceLearn.com​​ ​ (https://www.forcelearn.com)
Bhupathi YadavBhupathi Yadav
Thanks for Quick reply

 Thats not working for me
  Can you eloborate bit.
 
bhanu_prakashbhanu_prakash
Hi Bhupathi,

if your trying to call custom labels using apex, if you looking to update any custom labels records in test class , we cannot acheive that