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
Anonymous DeveloperAnonymous Developer 

Test automation logic Apex Specialist

Build tests for all cases (positive, negative, and bulk) specified in the business requirements by using a class named MaintenanceRequestHelperTest. You must have 100% test coverage to pass this section and assert values to prove that your logic is working as expected. Choose Run All Tests in the Developer Console at least once before attempting to submit this section. Be patient as it may take 10-20 seconds to process the challenge check.


Here's my code:

User-added image

User-added image

User-added image

User-added image

User-added image
 

 Equipment__c =cc.Equipment__c,

                    Origin = 'Web',

                    Date_Reported__c = Date.Today()

                    

                );

                

                If (maintenanceCycles.containskey(cc.Id)){

                    nc.Date_Due__c = Date.today().addDays((Integer) maintenanceCycles.get(cc.Id));

                }

                

                newCases.add(nc);

            }

            

           insert newCases;

            

           List<Equipment_Maintenance_Item__c> clonedWPs = new List<Equipment_Maintenance_Item__c>();

           for (Case nc : newCases){

                for (Equipment_Maintenance_Item__c wp : closedCasesM.get(nc.ParentId).Equipment_Maintenance_Items__r){

                    Equipment_Maintenance_Item__c wpClone = wp.clone();

                    wpClone.Maintenance_Request__c = nc.Id;

                    ClonedWPs.add(wpClone);

                    

                }

            }

            insert ClonedWPs;

        }

    }

}

MaintenanceRequest.apxt :-

trigger MaintenanceRequest on Case (before update, after update) { if(Trigger.isUpdate && Trigger.isAfter){ MaintenanceRequestHelper.updateWorkOrders(Trigger.New, Trigger.OldMap); } }


ERROR: Challenge Not yet complete... here's what's wrong:
We could not find the class 'MaintenanceRequestHelperTest' using assertions in the unit tests.
Sai PraveenSai Praveen (Salesforce Developers) 
Hi ,

Please note that Questions about how to pass Trailhead challenges are not on topic, because these challenges are intended to be independent demonstrations of your abilities.

Trailhead Help (https://trailhead.salesforce.com/en/help?support=home)

can provide assistance for situations where Trailhead does not appear to be functioning correctly.
 
You can reach out to them if this is the case.Hope above information helps.

 Please mark as Best Answer so that it can help others in future.

Thanks,