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
Raj ChongderRaj Chongder 

How to increase my code coverage

Apex class:

public with sharing class wod_UploadDocumentController {

 @AuraEnabled//(cacheable=true)
    public static List<string> getDoctype(Id recID){
        List<string> stroptions=new List<string>();
        for( string var : wod_UploadDocumentControllerDataSrvice.getDoctype( recID)){
            stroptions.add(var); 
        }    
       // stroptions.add('Roof Plan'); 
       system.debug(stroptions);

@AuraEnabled//(cacheable=true)
public static List<string> getDoctypePicklist(){
    List<string> stroptions = new List<string>();
    for( string var : wod_UploadDocumentControllerDataSrvice.getDoctypePicklist( )){
        stroptions.add(var); 
    }
   // stroptions.add('Roof Plan'); 
    return stroptions;
}

@AuraEnabled//(cacheable=true)
public static List<string> getExistingDocTypes(Id recID){
    Set<string> stroptions=new Set<string>();
    for( twod_bm__Document__c var : [select Id, twod_bm__Document_Type__c, Name from twod_bm__Document__c where
    twod_bm__Building__r.Id = :recId and twod_bm__Validated__c= true]){
        System.debug(var);
        stroptions.add(var.twod_bm__Document_Type__c); 
    }    
   // stroptions.add('Roof Plan'); 
    return new List<String>(stroptions);
}
            System.debug('lstDoc > '+ lstDoc);
            for(twod_bm__Document__c var: wod_UploadDocumentControllerDataSrvice.FetchGRSDocumentRecord(recID)){
                if(var.twod_bm__Validated__c == false || var.twod_bm__Document_Type__c == null){
                objwP=NEW DataWrapper();
                objwP.strDocId=var.Id;
                objWp.FileURL=var.twod_bm__Document_URL__c;
                objwP.strfileName=var.Name;
                 objwP.selectedType=var.twod_bm__Document_Type__c;
                objwP.IsValidated=var.twod_bm__Validated__c;
                objwP.strUserName=var.CreatedBy.Name;
                datetime dt=var.CreatedDate;
                objwP.strDateTime=''+dt.format('MM/dd/yyyy HH:mm:ss'); 
                
                lstDoc.add(objwP); 
               }
            } 
        }

Those lines in apex class its not covered^

Test class:

@istest
public class wod_UploadDocumentControllerTest {
    static testMethod void fetchassembly() {
        Test.startTest();
        Project__c objProject=WOD_DataFactoryTest.createProject();
        WOD_2__Inventory__c objInvn= WOD_DataFactoryTest.createInventory(objProject.id);
        Assembly_Template__c objTemp= WOD_DataFactoryTest.createAssemblytemp(objInvn.id);
        WOD_2__Warranty_Registration__c objwarranty= WOD_DataFactoryTest.createWarrantyRegistration(objInvn.id);
        Assembly__c objAsem=WOD_DataFactoryTest.createAssembly(objInvn.id);
        twod_bm__Assembly_Detail__c objassdet= WOD_DataFactoryTest.createAssemblydetail(objAsem.id);       
        
        ContentDocumentLink objdoclink= WOD_DataFactoryTest.createContentVersion(objInvn.id);
        // Insert objdoclink;
        Id DocRuleRecordTypeId = Schema.SObjectType.twod_bm__Business_Rule__c.getRecordTypeInfosByDeveloperName().get('Documents_Rules').getRecordTypeId();
        
        twod_bm__Business_Rule__c objBR= WOD_DataFactoryTest.createBusinessRule(objInvn.id,DocRuleRecordTypeId);
        twod_bm__Document__c objdoc= WOD_DataFactoryTest.createdocument(objInvn.id,objProject.id,objdoclink.contentdocumentid ,'SampleTitle');
        insert objdoc;
        Insert objBR;
        list<twod_bm__Document__c> lst=new list<twod_bm__Document__c>();
        twod_bm__Document__c obj=new twod_bm__Document__c();
        obj.name='test';
        lst.add(obj);
        // twod_bm__Assembly_Detail_Template__c objtempdata=WOD_DataFactoryTest.createAssemblydetailtemp(objassdet.id);
        wod_UploadDocumentController.getDoctype(objInvn.id);
        string strid=''+   wod_UploadDocumentController.FetchDocument(objInvn.id);
        wod_UploadDocumentController.saveDocument(lst);
        objdoc.twod_bm__Validated__c=true;
        update objdoc; 
        
        wod_UploadDocumentControllerDataSrvice.foxproDocChecklistFromReOpen = false;
        objInvn.twod_bm__Foxpro_Pull_Test__c = true;
        update objInvn;
        
        objInvn.twod_bm__Override_Doc_Type__c = 'Test, Test';
        update objInvn;
        //System.assertEquals(90, obj.Price__c);
        Test.stopTest();
    }
}

SwethaSwetha (Salesforce Developers) 
HI Raj,
Your code does not highlight which lines are uncovered in the question. The below information should help you get started.
 
https://salesforce.stackexchange.com/questions/244788/how-do-i-write-an-apex-unit-test
https://salesforce.stackexchange.com/questions/244794/how-do-i-increase-my-code-coverage-or-why-cant-i-cover-these-lines 
 
Thank you