You need to sign in to do that
Don't have an account?
Test class code coverage problem inside for loop
I just want to know why I'm not able to get the code coverage inside for loop when I'm just adding value to string variable in the for loop
![Why I'm not able cover that red line in the code](/forums/servlet/rtaImage?eid=9060G0000005qsp&feoid=Body&refid=0EM0G000000scfA)
Test class below:
Test class below:
@isTest Public class TestOrderAcknowledgement{ @isTest static void myTest() { String custmpo; Order__c orp=new Order__c(); orp.Date_of_Order__c=Date.today(); orp.Order_To_Street__c='Baasdfngavzdvladfore'; orp.customer_po__c='ewfew'; Insert orp; List<Ordger__c> order1=[Select Name,Id,customer_po__c from Order__c where Id=:orp.Id]; for(Order__c ord:order1){ custmpo=ord.customer_po__c; } Order_item__c orli=new Order_item__c(); orli.Name='221N4fdzgHY78'; orli.Description__c='this is description'; orli.price__c=283; orli.order__c=orp.id; orli.quantity__c=52; Insert orli; OrderAcknowledgement controll = new OrderAcknowledgement(new ApexPages.StandardController(orli)); } }
When I Just pass the Id like this I got It covered
Thanks