+ Start a Discussion
Sai ThejaSai Theja 

I need Help in Code Coverage

I covered 40% with the below test class. Help me to cover 75%.
Apex Class:
public class FFQExt 
{
Public attachment objAttachment
{
get
{
if (objAttachment == null)
objAttachment = new Attachment();
return objAttachment ;
}
set;
}
public Id recordId {get; set;}
Public FFQ__C l{get; set;}
public String currentRecordId {get;set;}
public FFQExt(ApexPages.StandardController stdCon) 
{
currentRecordId  = ApexPages.CurrentPage().getparameters().get('id');
this.recordId = stdCon.getId();
this.l = (FFQ__c)stdCon.getRecord();  
objAttachment = new Attachment();
l = new FFQ__c();
l = [select Name, id, Business_Address__c, Business_Phone_Number__c, City__c, Client__c, Corporate_Structure__c, County__c, CPA_Contact__c, CPA_Contact_Email__c, 
CPA_Contact_Name__c, CPA_Contact_Phone__c, Do_you_ever_rehire_employees__c, MultipleEIN__c, Do_you_have_plans_for_Future_Expansion__c, Do_you_have_Recent_Expansion__c,
EIN__c, Estimated_Date_of_Tax_Filing__c, estimated_number_of_employees_hired_per__c, Executive_Contact__c, Executive_Contact_Email__c, Executive_Contact_Name__c,
Executive_Contact_Phone__c, Federal_Empowerment_Zone_Wage_Credit__c, First_Name__c, First_NameofPerson__c, Fiscal_Year_End_Date__c, General_Tax_Status__c, 
How_many_current_employees_do_you_have__c, How_many_W2s_were_distributed_last_year__c, HR_Contact__c, HR_Contact_Email__c, HR_Contact_Name__c, HR_Contact_Phone__c,
HR_Platform_to_onboard_your_Employees__c, Indian_Employment_Tax_Credit__c, Invoice_Contact__c, Invoice_Contact_Email__c, Invoice_Contact_Name__c, Invoice_Contact_Phone__c,
Legal__c, Is_your_business_Seasonal__c, I_understand__c, Last_Name__c, Last_NameofPerson__c, Legal_Address__c, Legal_City__c, Legal_County__c, Legal_Entity_Name__c, Legal_State__c,
Legal_Zip__c, list_all_locations_worksites__c, Payroll_Contact__c, Payroll_Contact_Email__c, Payroll_Contact_Name__c, Payroll_Contact_Phone__c, Please_list_all_EIN_Legal_Entities_below__c, 
Primary_Contact_Email__c, Primary_Contact_Number__c, Primary_Contact_Title__c, State__c, States_State_IDs_with_Tax_Liability__c, State_Specific_Incentives__c, To_begin_participation__c,
Which_HR_Platform_are_you_utilizing__c, Which_Payroll_Provider_are_you_using__c, WOTC__c, Zip__c from FFQ__c where id =: currentRecordId ];

}
Public void dosave()
{
if(objAttachment.body == null) 
{
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please upload your Documents'));
return ApexPages.CurrentPage();
}
else
{
upsert l;
objAttachment.ParentId = l.id;
try 
{
upsert objAttachment;
}
catch (DMLException e) 
{
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error Submitting Form'));
return null;
}
finally
{
objAttachment.body = null; // clears the viewstate
objAttachment = new Attachment();
}
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.CONFIRM,'Form Submitted Successfully'));
 PageReference mypage = new PageReference('/apex/thankyou');
   mypage.setRedirect(true);
   return mypage;
return null;
}
}
}
Test Class:
 
@isTest
private class FFQExt_Test1{
  @testSetup
  static void setupTestData(){
    test.startTest();
    FFQ__c ffq_Obj = new FFQ__c(Name = 'Name714', First_Name__c = 'First917', Last_Name__c = 'Last_775', Primary_Contact_Title__c = 'Prima305', Primary_Contact_Email__c = 'Email16@test.com', Primary_Contact_Number__c = '54343-6724', Business_Address__c = '18', City__c = 'City__c632', State__c = 'Alabama', Zip__c = 'Zip__c497', Business_Phone_Number__c = '54343-92658', Legal_Entity_Name__c = 'Legal220', Legal__c = false, EIN__c = 25, MultipleEIN__c = false, Please_list_all_EIN_Legal_Entities_below__c = '27', list_all_locations_worksites__c = '28', Corporate_Structure__c = 'C-Corp', Estimated_Date_of_Tax_Filing__c = Date.today(), General_Tax_Status__c = 'Paying Regular Tax', Fiscal_Year_End_Date__c = Date.today(), States_State_IDs_with_Tax_Liability__c = '33', Do_you_have_Recent_Expansion__c = false, Do_you_have_plans_for_Future_Expansion__c = false, Executive_Contact_Name__c = 'Execu607', Executive_Contact_Email__c = 'Email37@test.com', Executive_Contact_Phone__c = '54343-11689', CPA_Contact_Name__c = 'CPA_C106', CPA_Contact_Phone__c = '54343-93693', CPA_Contact_Email__c = 'Email41@test.com', HR_Contact_Name__c = 'HR_Co140', HR_Contact_Email__c = 'Email43@test.com', HR_Contact_Phone__c = '54343-70632', Invoice_Contact_Name__c = 'Invoi739', Invoice_Contact_Email__c = 'Email46@test.com', Invoice_Contact_Phone__c = '54343-50578', Payroll_Contact_Name__c = 'Payro557', Payroll_Contact_Email__c = 'Email49@test.com', Payroll_Contact_Phone__c = '54343-67706', HR_Platform_to_onboard_your_Employees__c = 'Yes', Which_HR_Platform_are_you_utilizing__c = 'Which567', Which_Payroll_Provider_are_you_using__c = 'Which997', How_many_current_employees_do_you_have__c = 54, How_many_W2s_were_distributed_last_year__c = 55, estimated_number_of_employees_hired_per__c = 'estim415', Is_your_business_Seasonal__c = 'Is_yo660', Do_you_ever_rehire_employees__c = 'Do_yo497', First_NameofPerson__c = 'First430', Last_NameofPerson__c = 'Last_585', Legal_Address__c = '61', Legal_City__c = 'Legal521', Legal_Zip__c = 63, Legal_State__c = 'Alabama', WOTC__c = false, State_Specific_Incentives__c = false, Federal_Empowerment_Zone_Wage_Credit__c = false, Indian_Employment_Tax_Credit__c = false, Executive_Contact__c = false, CPA_Contact__c = false, HR_Contact__c = false, Invoice_Contact__c = false, Payroll_Contact__c = false, To_begin_participation__c = '74', County__c = 'Count208', Legal_County__c = 'Legal590', I_understand__c = 'Yes');
    Insert ffq_Obj; 
    test.stopTest();
  }
  static testMethod void test_dosave_UseCase1(){
    List<FFQ__c> ffq_Obj  =  [SELECT Id,Name,First_Name__c,Last_Name__c,Primary_Contact_Title__c,Primary_Contact_Email__c,Primary_Contact_Number__c,Business_Address__c,City__c,State__c,Zip__c,Business_Phone_Number__c,Legal_Entity_Name__c,Legal__c,EIN__c,MultipleEIN__c,Please_list_all_EIN_Legal_Entities_below__c,list_all_locations_worksites__c,Corporate_Structure__c,Estimated_Date_of_Tax_Filing__c,General_Tax_Status__c,Fiscal_Year_End_Date__c,States_State_IDs_with_Tax_Liability__c,Do_you_have_Recent_Expansion__c,Do_you_have_plans_for_Future_Expansion__c,Executive_Contact_Name__c,Executive_Contact_Email__c,Executive_Contact_Phone__c,CPA_Contact_Name__c,CPA_Contact_Phone__c,CPA_Contact_Email__c,HR_Contact_Name__c,HR_Contact_Email__c,HR_Contact_Phone__c,Invoice_Contact_Name__c,Invoice_Contact_Email__c,Invoice_Contact_Phone__c,Payroll_Contact_Name__c,Payroll_Contact_Email__c,Payroll_Contact_Phone__c,HR_Platform_to_onboard_your_Employees__c,Which_HR_Platform_are_you_utilizing__c,Which_Payroll_Provider_are_you_using__c,How_many_current_employees_do_you_have__c,How_many_W2s_were_distributed_last_year__c,estimated_number_of_employees_hired_per__c,Is_your_business_Seasonal__c,Do_you_ever_rehire_employees__c,First_NameofPerson__c,Last_NameofPerson__c,Legal_Address__c,Legal_City__c,Legal_Zip__c,Legal_State__c,WOTC__c,State_Specific_Incentives__c,Federal_Empowerment_Zone_Wage_Credit__c,Indian_Employment_Tax_Credit__c,Executive_Contact__c,CPA_Contact__c,HR_Contact__c,Invoice_Contact__c,Payroll_Contact__c,To_begin_participation__c,County__c,Legal_County__c,I_understand__c from FFQ__c];
    System.assertEquals(true,ffq_Obj.size()>0);
    PageReference pageRef = Page.FFQ;
    pageRef.getParameters().put('id','test');
    Test.setCurrentPage(pageRef);
    FFQExt obj01 = new FFQExt(new ApexPages.StandardController(ffq_Obj[0]));
    obj01.objAttachment = new attachment();
    obj01.recordId = '01p90000006uk2w';
    obj01.l = ffq_Obj[0];
    obj01.currentRecordId = 'test data';
    obj01.dosave();
  }
}


 
Best Answer chosen by Sai Theja
Raj VakatiRaj Vakati
Try this
 
@isTest
private class FFQExt_Test1{
  @testSetup
  static void setupTestData(){
    test.startTest();
    FFQ__c ffq_Obj = new FFQ__c(Name = 'Name714', First_Name__c = 'First917', Last_Name__c = 'Last_775', Primary_Contact_Title__c = 'Prima305', Primary_Contact_Email__c = 'Email16@test.com', Primary_Contact_Number__c = '54343-6724', Business_Address__c = '18', City__c = 'City__c632', State__c = 'Alabama', Zip__c = 'Zip__c497', Business_Phone_Number__c = '54343-92658', Legal_Entity_Name__c = 'Legal220', Legal__c = false, EIN__c = 25, MultipleEIN__c = false, Please_list_all_EIN_Legal_Entities_below__c = '27', list_all_locations_worksites__c = '28', Corporate_Structure__c = 'C-Corp', Estimated_Date_of_Tax_Filing__c = Date.today(), General_Tax_Status__c = 'Paying Regular Tax', Fiscal_Year_End_Date__c = Date.today(), States_State_IDs_with_Tax_Liability__c = '33', Do_you_have_Recent_Expansion__c = false, Do_you_have_plans_for_Future_Expansion__c = false, Executive_Contact_Name__c = 'Execu607', Executive_Contact_Email__c = 'Email37@test.com', Executive_Contact_Phone__c = '54343-11689', CPA_Contact_Name__c = 'CPA_C106', CPA_Contact_Phone__c = '54343-93693', CPA_Contact_Email__c = 'Email41@test.com', HR_Contact_Name__c = 'HR_Co140', HR_Contact_Email__c = 'Email43@test.com', HR_Contact_Phone__c = '54343-70632', Invoice_Contact_Name__c = 'Invoi739', Invoice_Contact_Email__c = 'Email46@test.com', Invoice_Contact_Phone__c = '54343-50578', Payroll_Contact_Name__c = 'Payro557', Payroll_Contact_Email__c = 'Email49@test.com', Payroll_Contact_Phone__c = '54343-67706', HR_Platform_to_onboard_your_Employees__c = 'Yes', Which_HR_Platform_are_you_utilizing__c = 'Which567', Which_Payroll_Provider_are_you_using__c = 'Which997', How_many_current_employees_do_you_have__c = 54, How_many_W2s_were_distributed_last_year__c = 55, estimated_number_of_employees_hired_per__c = 'estim415', Is_your_business_Seasonal__c = 'Is_yo660', Do_you_ever_rehire_employees__c = 'Do_yo497', First_NameofPerson__c = 'First430', Last_NameofPerson__c = 'Last_585', Legal_Address__c = '61', Legal_City__c = 'Legal521', Legal_Zip__c = 63, Legal_State__c = 'Alabama', WOTC__c = false, State_Specific_Incentives__c = false, Federal_Empowerment_Zone_Wage_Credit__c = false, Indian_Employment_Tax_Credit__c = false, Executive_Contact__c = false, CPA_Contact__c = false, HR_Contact__c = false, Invoice_Contact__c = false, Payroll_Contact__c = false, To_begin_participation__c = '74', County__c = 'Count208', Legal_County__c = 'Legal590', I_understand__c = 'Yes');
    Insert ffq_Obj; 
    test.stopTest();
  }
  static testMethod void test_dosave_UseCase1(){
    List<FFQ__c> ffq_Obj  =  [SELECT Id,Name,First_Name__c,Last_Name__c,Primary_Contact_Title__c,Primary_Contact_Email__c,Primary_Contact_Number__c,Business_Address__c,City__c,State__c,Zip__c,Business_Phone_Number__c,Legal_Entity_Name__c,Legal__c,EIN__c,MultipleEIN__c,Please_list_all_EIN_Legal_Entities_below__c,list_all_locations_worksites__c,Corporate_Structure__c,Estimated_Date_of_Tax_Filing__c,General_Tax_Status__c,Fiscal_Year_End_Date__c,States_State_IDs_with_Tax_Liability__c,Do_you_have_Recent_Expansion__c,Do_you_have_plans_for_Future_Expansion__c,Executive_Contact_Name__c,Executive_Contact_Email__c,Executive_Contact_Phone__c,CPA_Contact_Name__c,CPA_Contact_Phone__c,CPA_Contact_Email__c,HR_Contact_Name__c,HR_Contact_Email__c,HR_Contact_Phone__c,Invoice_Contact_Name__c,Invoice_Contact_Email__c,Invoice_Contact_Phone__c,Payroll_Contact_Name__c,Payroll_Contact_Email__c,Payroll_Contact_Phone__c,HR_Platform_to_onboard_your_Employees__c,Which_HR_Platform_are_you_utilizing__c,Which_Payroll_Provider_are_you_using__c,How_many_current_employees_do_you_have__c,How_many_W2s_were_distributed_last_year__c,estimated_number_of_employees_hired_per__c,Is_your_business_Seasonal__c,Do_you_ever_rehire_employees__c,First_NameofPerson__c,Last_NameofPerson__c,Legal_Address__c,Legal_City__c,Legal_Zip__c,Legal_State__c,WOTC__c,State_Specific_Incentives__c,Federal_Empowerment_Zone_Wage_Credit__c,Indian_Employment_Tax_Credit__c,Executive_Contact__c,CPA_Contact__c,HR_Contact__c,Invoice_Contact__c,Payroll_Contact__c,To_begin_participation__c,County__c,Legal_County__c,I_understand__c from FFQ__c];
    System.assertEquals(true,ffq_Obj.size()>0);
    PageReference pageRef = Page.FFQ;
    pageRef.getParameters().put('id',ffq_Obj[0].Id);
    Test.setCurrentPage(pageRef);
    FFQExt obj01 = new FFQExt(new ApexPages.StandardController(ffq_Obj[0]));
    obj01.objAttachment = new attachment();
    obj01.recordId = ffq_Obj[0].Id;
    obj01.l = ffq_Obj[0];
    obj01.currentRecordId = ffq_Obj[0].Id;
    obj01.dosave();
  
  
 }
}

 

All Answers

Raj VakatiRaj Vakati
Try this
 
@isTest
private class FFQExt_Test1{
  @testSetup
  static void setupTestData(){
    test.startTest();
    FFQ__c ffq_Obj = new FFQ__c(Name = 'Name714', First_Name__c = 'First917', Last_Name__c = 'Last_775', Primary_Contact_Title__c = 'Prima305', Primary_Contact_Email__c = 'Email16@test.com', Primary_Contact_Number__c = '54343-6724', Business_Address__c = '18', City__c = 'City__c632', State__c = 'Alabama', Zip__c = 'Zip__c497', Business_Phone_Number__c = '54343-92658', Legal_Entity_Name__c = 'Legal220', Legal__c = false, EIN__c = 25, MultipleEIN__c = false, Please_list_all_EIN_Legal_Entities_below__c = '27', list_all_locations_worksites__c = '28', Corporate_Structure__c = 'C-Corp', Estimated_Date_of_Tax_Filing__c = Date.today(), General_Tax_Status__c = 'Paying Regular Tax', Fiscal_Year_End_Date__c = Date.today(), States_State_IDs_with_Tax_Liability__c = '33', Do_you_have_Recent_Expansion__c = false, Do_you_have_plans_for_Future_Expansion__c = false, Executive_Contact_Name__c = 'Execu607', Executive_Contact_Email__c = 'Email37@test.com', Executive_Contact_Phone__c = '54343-11689', CPA_Contact_Name__c = 'CPA_C106', CPA_Contact_Phone__c = '54343-93693', CPA_Contact_Email__c = 'Email41@test.com', HR_Contact_Name__c = 'HR_Co140', HR_Contact_Email__c = 'Email43@test.com', HR_Contact_Phone__c = '54343-70632', Invoice_Contact_Name__c = 'Invoi739', Invoice_Contact_Email__c = 'Email46@test.com', Invoice_Contact_Phone__c = '54343-50578', Payroll_Contact_Name__c = 'Payro557', Payroll_Contact_Email__c = 'Email49@test.com', Payroll_Contact_Phone__c = '54343-67706', HR_Platform_to_onboard_your_Employees__c = 'Yes', Which_HR_Platform_are_you_utilizing__c = 'Which567', Which_Payroll_Provider_are_you_using__c = 'Which997', How_many_current_employees_do_you_have__c = 54, How_many_W2s_were_distributed_last_year__c = 55, estimated_number_of_employees_hired_per__c = 'estim415', Is_your_business_Seasonal__c = 'Is_yo660', Do_you_ever_rehire_employees__c = 'Do_yo497', First_NameofPerson__c = 'First430', Last_NameofPerson__c = 'Last_585', Legal_Address__c = '61', Legal_City__c = 'Legal521', Legal_Zip__c = 63, Legal_State__c = 'Alabama', WOTC__c = false, State_Specific_Incentives__c = false, Federal_Empowerment_Zone_Wage_Credit__c = false, Indian_Employment_Tax_Credit__c = false, Executive_Contact__c = false, CPA_Contact__c = false, HR_Contact__c = false, Invoice_Contact__c = false, Payroll_Contact__c = false, To_begin_participation__c = '74', County__c = 'Count208', Legal_County__c = 'Legal590', I_understand__c = 'Yes');
    Insert ffq_Obj; 
    test.stopTest();
  }
  static testMethod void test_dosave_UseCase1(){
    List<FFQ__c> ffq_Obj  =  [SELECT Id,Name,First_Name__c,Last_Name__c,Primary_Contact_Title__c,Primary_Contact_Email__c,Primary_Contact_Number__c,Business_Address__c,City__c,State__c,Zip__c,Business_Phone_Number__c,Legal_Entity_Name__c,Legal__c,EIN__c,MultipleEIN__c,Please_list_all_EIN_Legal_Entities_below__c,list_all_locations_worksites__c,Corporate_Structure__c,Estimated_Date_of_Tax_Filing__c,General_Tax_Status__c,Fiscal_Year_End_Date__c,States_State_IDs_with_Tax_Liability__c,Do_you_have_Recent_Expansion__c,Do_you_have_plans_for_Future_Expansion__c,Executive_Contact_Name__c,Executive_Contact_Email__c,Executive_Contact_Phone__c,CPA_Contact_Name__c,CPA_Contact_Phone__c,CPA_Contact_Email__c,HR_Contact_Name__c,HR_Contact_Email__c,HR_Contact_Phone__c,Invoice_Contact_Name__c,Invoice_Contact_Email__c,Invoice_Contact_Phone__c,Payroll_Contact_Name__c,Payroll_Contact_Email__c,Payroll_Contact_Phone__c,HR_Platform_to_onboard_your_Employees__c,Which_HR_Platform_are_you_utilizing__c,Which_Payroll_Provider_are_you_using__c,How_many_current_employees_do_you_have__c,How_many_W2s_were_distributed_last_year__c,estimated_number_of_employees_hired_per__c,Is_your_business_Seasonal__c,Do_you_ever_rehire_employees__c,First_NameofPerson__c,Last_NameofPerson__c,Legal_Address__c,Legal_City__c,Legal_Zip__c,Legal_State__c,WOTC__c,State_Specific_Incentives__c,Federal_Empowerment_Zone_Wage_Credit__c,Indian_Employment_Tax_Credit__c,Executive_Contact__c,CPA_Contact__c,HR_Contact__c,Invoice_Contact__c,Payroll_Contact__c,To_begin_participation__c,County__c,Legal_County__c,I_understand__c from FFQ__c];
    System.assertEquals(true,ffq_Obj.size()>0);
    PageReference pageRef = Page.FFQ;
    pageRef.getParameters().put('id',ffq_Obj[0].Id);
    Test.setCurrentPage(pageRef);
    FFQExt obj01 = new FFQExt(new ApexPages.StandardController(ffq_Obj[0]));
    obj01.objAttachment = new attachment();
    obj01.recordId = ffq_Obj[0].Id;
    obj01.l = ffq_Obj[0];
    obj01.currentRecordId = ffq_Obj[0].Id;
    obj01.dosave();
  
  
 }
}

 
This was selected as the best answer
Sai ThejaSai Theja
Hi Raj Vakati, Thanks for reply.
Now it's covering 62%.
Debaranjan GhoshDebaranjan Ghosh
Can you please send  the scipt to create FFQ__c
Sai ThejaSai Theja
I created one more use case, and now it's covering 93%.
@isTest
private class FFQExt_Test1{
  @testSetup
  static void setupTestData(){
    test.startTest();
    FFQ__c ffq_Obj = new FFQ__c(Name = 'Name714', First_Name__c = 'First917', Last_Name__c = 'Last_775', Primary_Contact_Title__c = 'Prima305', Primary_Contact_Email__c = 'Email16@test.com', Primary_Contact_Number__c = '54343-6724', Business_Address__c = '18', City__c = 'City__c632', State__c = 'Alabama', Zip__c = 'Zip__c497', Business_Phone_Number__c = '54343-92658', Legal_Entity_Name__c = 'Legal220', Legal__c = false, EIN__c = 25, MultipleEIN__c = false, Please_list_all_EIN_Legal_Entities_below__c = '27', list_all_locations_worksites__c = '28', Corporate_Structure__c = 'C-Corp', Estimated_Date_of_Tax_Filing__c = Date.today(), General_Tax_Status__c = 'Paying Regular Tax', Fiscal_Year_End_Date__c = Date.today(), States_State_IDs_with_Tax_Liability__c = '33', Do_you_have_Recent_Expansion__c = false, Do_you_have_plans_for_Future_Expansion__c = false, Executive_Contact_Name__c = 'Execu607', Executive_Contact_Email__c = 'Email37@test.com', Executive_Contact_Phone__c = '54343-11689', CPA_Contact_Name__c = 'CPA_C106', CPA_Contact_Phone__c = '54343-93693', CPA_Contact_Email__c = 'Email41@test.com', HR_Contact_Name__c = 'HR_Co140', HR_Contact_Email__c = 'Email43@test.com', HR_Contact_Phone__c = '54343-70632', Invoice_Contact_Name__c = 'Invoi739', Invoice_Contact_Email__c = 'Email46@test.com', Invoice_Contact_Phone__c = '54343-50578', Payroll_Contact_Name__c = 'Payro557', Payroll_Contact_Email__c = 'Email49@test.com', Payroll_Contact_Phone__c = '54343-67706', HR_Platform_to_onboard_your_Employees__c = 'Yes', Which_HR_Platform_are_you_utilizing__c = 'Which567', Which_Payroll_Provider_are_you_using__c = 'Which997', How_many_current_employees_do_you_have__c = 54, How_many_W2s_were_distributed_last_year__c = 55, estimated_number_of_employees_hired_per__c = 'estim415', Is_your_business_Seasonal__c = 'Is_yo660', Do_you_ever_rehire_employees__c = 'Do_yo497', First_NameofPerson__c = 'First430', Last_NameofPerson__c = 'Last_585', Legal_Address__c = '61', Legal_City__c = 'Legal521', Legal_Zip__c = 63, Legal_State__c = 'Alabama', WOTC__c = false, State_Specific_Incentives__c = false, Federal_Empowerment_Zone_Wage_Credit__c = false, Indian_Employment_Tax_Credit__c = false, Executive_Contact__c = false, CPA_Contact__c = false, HR_Contact__c = false, Invoice_Contact__c = false, Payroll_Contact__c = false, To_begin_participation__c = '74', County__c = 'Count208', Legal_County__c = 'Legal590', I_understand__c = 'Yes');
    Insert ffq_Obj; 
    test.stopTest();
  }
  static testMethod void test_dosave_UseCase1(){
    List<FFQ__c> ffq_Obj  =  [SELECT Id,Name,First_Name__c,Last_Name__c,Primary_Contact_Title__c,Primary_Contact_Email__c,Primary_Contact_Number__c,Business_Address__c,City__c,State__c,Zip__c,Business_Phone_Number__c,Legal_Entity_Name__c,Legal__c,EIN__c,MultipleEIN__c,Please_list_all_EIN_Legal_Entities_below__c,list_all_locations_worksites__c,Corporate_Structure__c,Estimated_Date_of_Tax_Filing__c,General_Tax_Status__c,Fiscal_Year_End_Date__c,States_State_IDs_with_Tax_Liability__c,Do_you_have_Recent_Expansion__c,Do_you_have_plans_for_Future_Expansion__c,Executive_Contact_Name__c,Executive_Contact_Email__c,Executive_Contact_Phone__c,CPA_Contact_Name__c,CPA_Contact_Phone__c,CPA_Contact_Email__c,HR_Contact_Name__c,HR_Contact_Email__c,HR_Contact_Phone__c,Invoice_Contact_Name__c,Invoice_Contact_Email__c,Invoice_Contact_Phone__c,Payroll_Contact_Name__c,Payroll_Contact_Email__c,Payroll_Contact_Phone__c,HR_Platform_to_onboard_your_Employees__c,Which_HR_Platform_are_you_utilizing__c,Which_Payroll_Provider_are_you_using__c,How_many_current_employees_do_you_have__c,How_many_W2s_were_distributed_last_year__c,estimated_number_of_employees_hired_per__c,Is_your_business_Seasonal__c,Do_you_ever_rehire_employees__c,First_NameofPerson__c,Last_NameofPerson__c,Legal_Address__c,Legal_City__c,Legal_Zip__c,Legal_State__c,WOTC__c,State_Specific_Incentives__c,Federal_Empowerment_Zone_Wage_Credit__c,Indian_Employment_Tax_Credit__c,Executive_Contact__c,CPA_Contact__c,HR_Contact__c,Invoice_Contact__c,Payroll_Contact__c,To_begin_participation__c,County__c,Legal_County__c,I_understand__c from FFQ__c];
    System.assertEquals(true,ffq_Obj.size()>0);
    PageReference pageRef = Page.FFQ;
    pageRef.getParameters().put('id',ffq_Obj[0].Id);
    Test.setCurrentPage(pageRef);
    FFQExt obj01 = new FFQExt(new ApexPages.StandardController(ffq_Obj[0]));
    obj01.objAttachment = new attachment();
    obj01.recordId = ffq_Obj[0].Id;
    obj01.l = ffq_Obj[0];
    obj01.currentRecordId = ffq_Obj[0].Id;
    obj01.dosave();
  }
    static testMethod void test_dosave_UseCase2(){
    List<FFQ__c> ffq_Obj  =  [SELECT Id,Name,First_Name__c,Last_Name__c,Primary_Contact_Title__c,Primary_Contact_Email__c,Primary_Contact_Number__c,Business_Address__c,City__c,State__c,Zip__c,Business_Phone_Number__c,Legal_Entity_Name__c,Legal__c,EIN__c,MultipleEIN__c,Please_list_all_EIN_Legal_Entities_below__c,list_all_locations_worksites__c,Corporate_Structure__c,Estimated_Date_of_Tax_Filing__c,General_Tax_Status__c,Fiscal_Year_End_Date__c,States_State_IDs_with_Tax_Liability__c,Do_you_have_Recent_Expansion__c,Do_you_have_plans_for_Future_Expansion__c,Executive_Contact_Name__c,Executive_Contact_Email__c,Executive_Contact_Phone__c,CPA_Contact_Name__c,CPA_Contact_Phone__c,CPA_Contact_Email__c,HR_Contact_Name__c,HR_Contact_Email__c,HR_Contact_Phone__c,Invoice_Contact_Name__c,Invoice_Contact_Email__c,Invoice_Contact_Phone__c,Payroll_Contact_Name__c,Payroll_Contact_Email__c,Payroll_Contact_Phone__c,HR_Platform_to_onboard_your_Employees__c,Which_HR_Platform_are_you_utilizing__c,Which_Payroll_Provider_are_you_using__c,How_many_current_employees_do_you_have__c,How_many_W2s_were_distributed_last_year__c,estimated_number_of_employees_hired_per__c,Is_your_business_Seasonal__c,Do_you_ever_rehire_employees__c,First_NameofPerson__c,Last_NameofPerson__c,Legal_Address__c,Legal_City__c,Legal_Zip__c,Legal_State__c,WOTC__c,State_Specific_Incentives__c,Federal_Empowerment_Zone_Wage_Credit__c,Indian_Employment_Tax_Credit__c,Executive_Contact__c,CPA_Contact__c,HR_Contact__c,Invoice_Contact__c,Payroll_Contact__c,To_begin_participation__c,County__c,Legal_County__c,I_understand__c from FFQ__c];
    System.assertEquals(true,ffq_Obj.size()>0);
    PageReference pageRef = Page.FFQ;
    pageRef.getParameters().put('id',ffq_Obj[0].Id);
    Test.setCurrentPage(pageRef);
    FFQExt obj01 = new FFQExt(new ApexPages.StandardController(ffq_Obj[0]));
    obj01.objAttachment = new Attachment();
    obj01.objAttachment.body  = Blob.valueOf('test');  
    obj01.recordId = ffq_Obj[0].Id;
    obj01.l = ffq_Obj[0];
    obj01.currentRecordId = ffq_Obj[0].Id;
          obj01.dosave();
      }
  
 
}

Thank You.