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
vara sreevara sree 

how to improve code coverage of below test class

@isTest(SeeAllData=false)
private class TestOrderProductComponentController {
  /*
    public variables here
  */
  public static NA_Order__c order4Test;
  public static Account acc4Test;

  /*
    testMethod here
  */
  static testMethod void testWithOutProduct() {
    initalize();

    OrderProductComponentController controller = new OrderProductComponentController();

    Test.startTest();

      Map<String, Set<String>> cropVarietyMap = controller.cropVarietyMap;
      controller.queryTECP();
      Map<String, Map<String, Map<String, Set<String>>>> TECPMapofMapTest = controller.TECPMapofMap;
      NA_Order_Line_Item__c orderLineTest = controller.orderLine;
      List<SelectOption> cropOptionsTest = controller.cropOptions;
      List<SelectOption> varietyOptionsTest = controller.varietyOptions;
      List<SelectOption> treatmentOptionsTest = controller.treatmentOptions;
      List<SelectOption> enhancementOptionsTest = controller.enhancementOptions;
      List<SelectOption> carrierOptionsTest = controller.carrierOptions;
      List<SelectOption> packagingOptionsTest = controller.packagingOptions;
      String cropTest = controller.crop;
      String varietyTest = controller.variety;
      controller.validateQuantity();

    Test.stopTest();
  }

  static testMethod void testWithProducts() {
    initalize();

    OrderProductComponentController controller = new OrderProductComponentController();

    Test.startTest();

    Test.stopTest();
  }
  /*
    initalize here
  */
  public static void initalize() {
    acc4Test = TestUtils.createAccount('AccForTestingOrderProductPicker', 'USD', true);
    order4Test = TestUtils.createOrder('Spot Order', Date.today(), 'UPS', 'OrderForTestingOrderProductPicker', 'Created', acc4Test.Id, true);

    PageReference orderProductPicker = Page.Order;
    orderProductPicker.getParameters().put('Id', order4Test.Id);

    Test.setCurrentPage(orderProductPicker);
  }
}
Shashikant SharmaShashikant Sharma
Could you share the class which you are testing and explain which part of code is not covered.