+ 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*/\

            currencies = [Select label from RLWS_Obj_Currency__mdt Limit 100];

Can you please tel how to cover this area
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 :) :)
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.
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