You need to sign in to do that
Don't have an account?
Ella
Write an Apex Test Class for my Apex Class
Hello,
I have the following apex class and I need to write a test apex class for it. I started writing it but the code coverage is 0% . I am new into this and I don't know how to write it - can somebody help me ?
APEX Class :
public class GetAccount {
@AuraEnabled
public static List<Account> getAccountList(String currentId){
List<Account> lstAcc = new List<Account>();
lstAcc = [Select id,Has_Code_Red_Cases__c,Has_Critical_Situation_Request_Cases__c from Account where id =: currentId];
return lstAcc;
}
}
TEST APEX CLASS:
@isTest
public class GetAccountTest
{
static testMethod void testMethod1()
{
Account acc = new Account();
acc.Name = 'Test Account';
insert acc;
}
}
I have the following apex class and I need to write a test apex class for it. I started writing it but the code coverage is 0% . I am new into this and I don't know how to write it - can somebody help me ?
APEX Class :
public class GetAccount {
@AuraEnabled
public static List<Account> getAccountList(String currentId){
List<Account> lstAcc = new List<Account>();
lstAcc = [Select id,Has_Code_Red_Cases__c,Has_Critical_Situation_Request_Cases__c from Account where id =: currentId];
return lstAcc;
}
}
TEST APEX CLASS:
@isTest
public class GetAccountTest
{
static testMethod void testMethod1()
{
Account acc = new Account();
acc.Name = 'Test Account';
insert acc;
}
}
Try The Below Test Class
Changes Are In Bold
You Have To Give The Refference If Your Class Name And Method Which You Want To Test Please Mark It As Best Answer If It Helps
Thank You!