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
Nishit MistryyyNishit Mistryyy 

test class for milestone date

I have a class and I want to write a test class for it, The code of the class is as follows:

public class MilestoneUtils {

    public static void completeMilestone(List<Id> caseIds, DateTime complDate) {  
    List<CaseMilestone> cmsToUpdate = [select Id, completionDate
            from CaseMilestone cm
            where caseId in :caseIds 
            and completionDate = null limit 1];
    if (cmsToUpdate.isEmpty() == false){
        for (CaseMilestone cm : cmsToUpdate){
            cm.completionDate = complDate;
        update cmsToUpdate;

SwethaSwetha (Salesforce Developers) 
HI Nishit,
Please highlight which lines of code are uncovered. The below articles give a good insight into how coverage can be improved 
Examples of Milestone completion test classes:

If this information helps, please mark the answer as best. Thank you