You need to sign in to do that
Don't have an account?
Heather_Hanson
Need help with test class...not sure why I'm getting 0 code coverage
I wrote a test class for my class related to a lightning component, but when I run it I get 0 coverage.
Here is the class that needs to be tested:
My test class basically has me creating a record of the objects needed before a User_List record is created and then it creates a User_List record.
This is my first time working with Lightning Components and alot of my test classes do the same thing so I'm wondering if I need to do something different here?
Help would be greatly appreciated!
Here is the class that needs to be tested:
public class User_List { @AuraEnabled public static list <User_List__c> fetchList(){ List <User_List__c> returnUserList = new List < User_List__c > (); for(User_List__c ul: [SELECT id, First_Name__c, Last_Name__c, Email__c, Extension_Number__c, Type_of_User_License__c, Phone_Model__c, Language__c, Outbound_Number_Display__c, Outbound_Name_Display__c, Voicemail_Option__c, CFNR_Number__c From User_List__c LIMIT 1000]) { returnUserList.add(ul); } return returnUserList; } }
My test class basically has me creating a record of the objects needed before a User_List record is created and then it creates a User_List record.
This is my first time working with Lightning Components and alot of my test classes do the same thing so I'm wondering if I need to do something different here?
Help would be greatly appreciated!
List<User_List__c> testList = User_List.fetchList();
And then run some assertions on the testList to verify that it does what you want it to, like:
System.assertEquals(2, testList.size());
All Answers
List<User_List__c> testList = User_List.fetchList();
And then run some assertions on the testList to verify that it does what you want it to, like:
System.assertEquals(2, testList.size());