Skip to main content
added 609 characters in body
Source Link
Eric
  • 54.4k
  • 11
  • 104
  • 196

I do not see where you are creating any Business_Unit_Project_Portfolio_Lookup__c records thus why those lines are not being covered but if your are then they do not have the proper values in the Project_Portfolio__c where they match the records you created in your setupdata

You SOQL is not returning records in the for loop thus why the inside of the for is not covered.

Mock the records appropriately and you will have coverage.

In addition, you should not be calling the class directly from your test method. To test properly you should be:

  1. Creating records
  2. executing a DML delete on the appropriate records
  3. do a query for those records
  4. assert that what should have happened did.

If you then want to call the class directly from your tests to test other scenarios you can but you should first build your test out like it actually happens from the UI

I do not see where you are creating any Business_Unit_Project_Portfolio_Lookup__c records thus why those lines are not being covered

I do not see where you are creating any Business_Unit_Project_Portfolio_Lookup__c records thus why those lines are not being covered but if your are then they do not have the proper values in the Project_Portfolio__c where they match the records you created in your setupdata

You SOQL is not returning records in the for loop thus why the inside of the for is not covered.

Mock the records appropriately and you will have coverage.

In addition, you should not be calling the class directly from your test method. To test properly you should be:

  1. Creating records
  2. executing a DML delete on the appropriate records
  3. do a query for those records
  4. assert that what should have happened did.

If you then want to call the class directly from your tests to test other scenarios you can but you should first build your test out like it actually happens from the UI

Source Link
Eric
  • 54.4k
  • 11
  • 104
  • 196

I do not see where you are creating any Business_Unit_Project_Portfolio_Lookup__c records thus why those lines are not being covered