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
VINODKUMAR REDDY KALUVAVINODKUMAR REDDY KALUVA 

code coverage problem in below nested for loop

HI 

I have tried a lot for below class code coverage but I'm not able to fix that, some can try the below challenges.
I'm facing exact problem in nested for loop(not able to get a code coverage).
This is the images that shows you the code coverage probelm

Test class:
 

@isTest (SeeAllData = true) 
Public class TestQuoteToOrder{

 
      @isTest(seealldata=true) static void myunittest1(){
      
      Account acc=new Account();
       acc.Name='Njhhjn';
       acc.Industry__c='Energy';
       acc.Activity__c='End User';
       Acc.BillingCountry='Iia';
       Acc.BillingState='Sikkim';
       Acc.BillingCity='dsad';            
       Acc.BillingStreet='dsaf';             
       Acc.BillingPostalCode='453658';         
        
      Insert acc;
       
       opportunity opp=new opportunity();
         
       opp.Name='test 5';
       opp.CloseDate=date.today();
       opp.StageName='Qualification';
       opp.Product_Type__c='Standard Product';
       opp.Accountid=acc.Id;
       
       opp.N_EP_DPI__c='F/17/213';
       opp.Competitor_Name__c='tets';
       opp.CustomerDevelopment__c='Difficult to create any relationship';
       opp.Estimated_Starting_Date_Of_Mass_Producti__c=date.today();
       opp.Date_For_Proto_types__c=date.today();
       
       Insert opp;
       
       
       Quote__c qu=new Quote__c();
     
         qu.Opportunity_Name__c = opp.Id;
         qu.Account_Name__c = acc.Id;
         
         Insert qu;
     
          
       Quote_line_item__c qli=new Quote_line_item__c();
        qli.Name='test';
        qli.Quote1__c = qu.id;
     
       Insert qli;
       
           //List<Quote__c> qu1=new List<Quote__c>(); 
       Quote__c quii=[select Name,Payment_Terms__c,Account_name__c,Or_contact_Email__c,Or_contact_Phone__c,(select Id,Name,Final_Price__c,Asked_Qty__c,Description__c,Client_P_N__c from Quote_Line_Items__r) from Quote__c LIMIT 1];
       
          
          //qu1.add(quii);
                 
       
       
         order__c qu2=new Order__c();
                qu2.Date_of_Order__c=Date.today();
                qu2.Order_To_Street__c='Bore';
                //qu2.Payment_Terms__c=qu1.Payment_Terms__c;
                //qu2.Quote__c=qu1.id;
                qu2.Account__c=qu.Account_name__c;
       
           Insert qu2;
             
  
       
           Order_item__c orli=new Order_item__c();
           
           orli.Name=qli.Name;
           orli.Description__c=qli.description__c;
           orli.price__c=283;
           //orli.order__c=qu1.Name;
           orli.quantity__c=52;
           
           Insert orli;
         
       System.assertEquals(orli,orli);
          
        Integer rowIndex=1;
        //QuoteToOrder controll=new QuoteToOrder(new apexpages.StandardController(qu));
       ApexPages.StandardController sc= new ApexPages.StandardController(qu);
         QuoteToOrder controll=new QuoteToOrder(sc); 
       
       controll.addrow();
       //controll.remove();   
       controll.deleterow();
       controll.Osave();
       
   }

}

devedeve
Hi Vinod,

You are not getting value in allopps variable of class.
Which you are fetching using query but that query is not visible in the picture you have shared so is it include any filter criteria?
VINODKUMAR REDDY KALUVAVINODKUMAR REDDY KALUVA
Hi Deve,

That is just a nested query in that query I'm just passing Id that all.
i don't know how to write test class to cover the code in the apex class.