You need to sign in to do that
Don't have an account?
Dastagiri Basha
Hello All, I need to write test class for the below code. Can any one help me
List<Employee__c> empList;
AggregateResult[] atteList;
AggregateResult[] LeaveList;
if(empIds.size() >0){
empList = [SELECT Id,Name,Basic_Salary__c,Employee_ID__c FROM Employee__c WHERE Not (Id IN :empIds)];
atteList = [SELECT Count(Id)cnt,Employee__c FROM Attendance__c WHERE Month_and_year__c=:monthYear AND (NOT (Employee__c IN : empIds)) GROUP BY Employee__c];
LeaveList = [SELECT SUM(No_of_Days__c)noL,Employee__c FROM Leave__c WHERE Month_and_year__c=:monthYear AND (NOT (Employee__c IN : empIds)) AND (Approval_Status__c ='Accept' OR Approval_Status__c ='Edit & Accept') GROUP BY Employee__c];
}
AggregateResult[] atteList;
AggregateResult[] LeaveList;
if(empIds.size() >0){
empList = [SELECT Id,Name,Basic_Salary__c,Employee_ID__c FROM Employee__c WHERE Not (Id IN :empIds)];
atteList = [SELECT Count(Id)cnt,Employee__c FROM Attendance__c WHERE Month_and_year__c=:monthYear AND (NOT (Employee__c IN : empIds)) GROUP BY Employee__c];
LeaveList = [SELECT SUM(No_of_Days__c)noL,Employee__c FROM Leave__c WHERE Month_and_year__c=:monthYear AND (NOT (Employee__c IN : empIds)) AND (Approval_Status__c ='Accept' OR Approval_Status__c ='Edit & Accept') GROUP BY Employee__c];
}
The below Test class is giving 90% coverage. Please let me know if you need any further help.
If this solution helps, Please mark it as best answer.
Thanks,