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
Holly Havelka 10Holly Havelka 10 

Need Help Writing My Test Class

Hi All,

I am still learning how to write test class coverage.  Working on an org where a controller never had proper test code coverage.  

Here is the controller:
public class UpdateResumeController {
    
    public List<Organizational_History__c> breakthroughHistoryList {get; set;}
    public List<Organizational_History__c> educationHistoryList {get; set;}
    public List<Organizational_History__c> employmentHistoryList {get; set;}
    public List<SelectOption> sitesOptionList {get; set;}
    public Boolean editBreakthrough {get; set;}
    public Boolean editEducation {get; set;}
    public Boolean editEmployment {get; set;}
    public Boolean allowEdit {get; set;} 
    public String loggedInContactId;
    private Id organizationId;
    private Id breakthroughRecordTypeId;
    private Id educationRecordTypeId;
    private Id employmentRecordTypeId;
    
    public String getLoggedInContactId() {
        return loggedInContactId;
    }
    
    public void setLoggedInContactId(String currentContactId) {
        if (String.isEmpty(loggedInContactId)) {
            loggedInContactId = currentContactId;
            breakthroughHistoryList = [SELECT Organization__c, Type__c, Breakthrough_Year__c FROM Organizational_History__c WHERE Breakthrough_Contact__c = :loggedInContactId AND RecordType.Name = 'Breakthrough History' ORDER BY Breakthrough_Year__c ASC];
            educationHistoryList = [SELECT School__c, Graduation_Year__c, Field_of_Study__c, Degree__c, City__c, State__c, Country__c FROM Organizational_History__c WHERE Education_Contact__c = :loggedInContactId AND RecordType.Name = 'Educational History' ORDER BY Graduation_Year__c ASC];
            employmentHistoryList = [SELECT Employer__c, Role__c, City__c, State__c, Country__c, Start_Year__c, End_Year__c FROM Organizational_History__c WHERE Employment_Contact__c = :loggedInContactId AND RecordType.Name = 'Employment History' ORDER BY Start_Year__c ASC];
            organizationId = [SELECT AccountId FROM Contact WHERE Id = :loggedInContactId].AccountId;
            breakthroughRecordTypeId = [SELECT Id FROM RecordType WHERE Name = 'Breakthrough History'].Id;
            educationRecordTypeId = [SELECT Id FROM RecordType WHERE Name = 'Educational History'].Id;
            employmentRecordTypeId = [SELECT Id FROM RecordType WHERE Name = 'Employment History'].Id;
        }
    }
    
    public UpdateResumeController(){
        sitesOptionList = new List<SelectOption>();
        List <Account> sitesList = [SELECT Portal_Display_Name__c FROM Account WHERE RecordType.Name = 'Breakthrough Organization' AND Program_Status__c IN ('Active', 'Inactive')];
        for (Account acc : sitesList){
            if (acc.Portal_Display_Name__c != null){
                sitesOptionList.add(new SelectOption(acc.Id, acc.Portal_Display_Name__c));
            }
        }
        editBreakthrough = false;
        editEducation = false;
        editEmployment = false;
        String contactId = ApexPages.currentPage().getParameters().get('Id');
        system.debug(contactId);
        system.debug(loggedInContactId);
        allowEdit = loggedInContactId == contactId || contactId == null;
    }
    
    public void enableEditBreakthrough(){
        editBreakthrough = true;
    }
    public void cancelEditBreakthrough(){
        breakthroughHistoryList = [SELECT Organization__c, Type__c, Breakthrough_Year__c FROM Organizational_History__c WHERE Breakthrough_Contact__c = :loggedInContactId AND RecordType.Name = 'Breakthrough History' ORDER BY Breakthrough_Year__c ASC];
        editBreakthrough = false;
    }
    public void addBreakthroughHistory(){
        List<Organizational_History__c> breakthroughHistoryListAux = new List<Organizational_History__c>();
        breakthroughHistoryListAux.add(new Organizational_History__c(Breakthrough_Contact__c=loggedInContactId, RecordTypeId = breakthroughRecordTypeId));
        breakthroughHistoryListAux.addAll(breakthroughHistoryList);
        breakthroughHistoryList = breakthroughHistoryListAux;
        enableEditBreakthrough();
    }
    public void saveBreakthroughHistory(){
        upsert breakthroughHistoryList;
        editBreakthrough = false;
    }
    
    public void enableEditEducation(){
        editEducation = true;
    }
    public void cancelEditEducation(){
        educationHistoryList = [SELECT School__c, Graduation_Year__c, Field_of_Study__c, Degree__c, City__c, State__c, Country__c FROM Organizational_History__c WHERE Education_Contact__c = :loggedInContactId AND RecordType.Name = 'Educational History' ORDER BY Graduation_Year__c ASC];
        editEducation = false;
    }
    public void addEducationHistory(){
        List<Organizational_History__c> educationHistoryListAux = new List<Organizational_History__c>();
        educationHistoryListAux.add(new Organizational_History__c(Organization__c = organizationId, Education_Contact__c=loggedInContactId, RecordTypeId = educationRecordTypeId));
        educationHistoryListAux.addAll(educationHistoryList);
        educationHistoryList = educationHistoryListAux;
        enableEditEducation();
    }
    public void saveEducationHistory(){
        upsert educationHistoryList;
        editEducation = false;
    }
    
    public void enableEditEmployment(){
        editEmployment = true;
    }
    public void cancelEditEmployment(){
        employmentHistoryList = [SELECT Employer__c, Role__c, City__c, Country__c, State__c, Start_Year__c, End_Year__c FROM Organizational_History__c WHERE Employment_Contact__c = :loggedInContactId AND RecordType.Name = 'Employment History' ORDER BY Start_Year__c ASC];
        editEmployment = false;
    }
    public void addEmploymentHistory(){
        List<Organizational_History__c> employmentHistoryListAux = new List<Organizational_History__c>();
        employmentHistoryListAux.add(new Organizational_History__c(Organization__c = organizationId, Employment_Contact__c=loggedInContactId, RecordTypeId = employmentRecordTypeId));
        employmentHistoryListAux.addAll(employmentHistoryList);
        employmentHistoryList = employmentHistoryListAux;
        enableEditEmployment();
    }
    public void saveEmploymentHistory(){
        upsert employmentHistoryList;
        editEmployment = false;
    }
    
    public PageReference deleteRecord(){
        String recordId = Apexpages.currentPage().getParameters().get('recordId');
        String recordType = Apexpages.currentPage().getParameters().get('recordType');
        system.debug(recordType);
        system.debug(recordId);
        delete [SELECT Id FROM Organizational_History__c WHERE Id = :recordId];
        Integer i = 0;
        if (recordType == 'breakthrough'){
            breakthroughHistoryList = [SELECT Organization__c, Type__c, Breakthrough_Year__c FROM Organizational_History__c WHERE Breakthrough_Contact__c = :loggedInContactId AND RecordType.Name = 'Breakthrough History' ORDER BY Breakthrough_Year__c ASC];
        } else if (recordType == 'education'){
            educationHistoryList = [SELECT School__c, Graduation_Year__c, Field_of_Study__c, Degree__c, City__c, State__c FROM Organizational_History__c WHERE Education_Contact__c = :loggedInContactId AND RecordType.Name = 'Educational History' ORDER BY Graduation_Year__c ASC];
        } else if (recordType == 'employment'){
            employmentHistoryList = [SELECT Employer__c, Role__c, City__c, State__c, Country__c, Start_Year__c, End_Year__c FROM Organizational_History__c WHERE Employment_Contact__c = :loggedInContactId AND RecordType.Name = 'Employment History' ORDER BY Start_Year__c ASC];
        }
        return null;
    }
}
Here is the test class (not sufficient only at 20%):
@isTest
private class UpdateResumeControllerTest {

  static testMethod void myUnitTest() {
    
    //RecordType bo = [SELECT Id FROM RecordType WHERE Name = 'Breakthrough Organization'];
    //RecordType alumni = [SELECT Id FROM RecordType WHERE Name = 'Student Alumni'];

    Account testAcc = AccountUtils.createBreakthroughOrgAccount('Breakthrough Alumni Test', true);
    testAcc.Program_Status__c='Inactive';
    update testAcc;
    //insert testAcc;
    
    Contact testContact = ContactUtils.createAlumniContact('MyNew', 'Alumnus1', 'myalumnus1@org.test', testAcc.Id, true);
    //insert testContact;
    
    //Profile testProf = [SELECT Id FROM Profile WHERE Name='Portal Per Login User'];
    
    User testUser = UserUtils.createAlumniCommunityUser(testContact, false, true);
    //insert testUser;  
    Test.startTest();
    system.runAs(testUser){
      
      UpdateResumeController urc = new UpdateResumeController();
    
      
        urc.enableEditBreakthrough();
      
      
      system.assert(urc.editBreakthrough);        
    }
    Test.stopTest();
  }
}

 
Best Answer chosen by Holly Havelka 10
Nithesh NNithesh N
 
       UpdateResumeController urc = new UpdateResumeController();
    
        urc.enableEditBreakthrough();
        //urc.setLoggedInContactId(testContact.Id);
        String userString = urc.getLoggedInContactId();
        urc.cancelEditBreakthrough();
        urc.enableEditBreakthrough();
        urc.addBreakthroughHistory();
        //urc.saveBreakthroughHistory();
        urc.enableEditEducation();
        urc.cancelEditEducation();
        urc.addEducationHistory();
        //urc.saveEducationHistory();
        urc.enableEditEmployment();
        urc.cancelEditEmployment();
        urc.addEmploymentHistory();
        //urc.saveEmploymentHistory();
        PageReference pageRef = Page.myprofile;
        Test.setCurrentPage(pageRef);
        pageRef.getParameters().put('recordId',testContact.Id);
        pageRef.getParameters().put('recordType','breakthrough');

Replace Lines (24 - 41) with the above. 

Try now. 
 

All Answers

Nithesh NNithesh N
Try adding this code snippet, on line 28 right under urc.enableEditBreakthrough();
uncomment the line15 and Line 20.
urc.setLoggedInContactId(testContact.Id);
String userString = urc.getLoggedInContactId();
urc.cancelEditBreakthrough();
urc.addEmploymentHistory();
urc.addBreakthroughHistory();
urc.saveBreakthroughHistory();
urc.enableEditEducation();
urc.cancelEditEducation();
urc.addEducationHistory();
urc.saveEducationHistory();
urc.enableEditEmployment();
urc.cancelEditEmployment();
urc.addEmploymentHistory();
urc.saveEmploymentHistory();
PageReference pf = ​urc.deleteRecord();

Let me know if it works.
Holly Havelka 10Holly Havelka 10
Hi Nithesh N

I put in your suggestions, see below:
@isTest
private class UpdateResumeControllerTest {

  static testMethod void myUnitTest() {
    
    //RecordType bo = [SELECT Id FROM RecordType WHERE Name = 'Breakthrough Organization'];
    //RecordType alumni = [SELECT Id FROM RecordType WHERE Name = 'Student Alumni'];

    Account testAcc = AccountUtils.createBreakthroughOrgAccount('Breakthrough Alumni Test', true);
    testAcc.Program_Status__c='Inactive';
    update testAcc;
    //insert testAcc;
    
    Contact testContact = ContactUtils.createAlumniContact('MyNew', 'Alumnus1', 'myalumnus1@org.test', testAcc.Id, true);
    insert testContact;
    
    //Profile testProf = [SELECT Id FROM Profile WHERE Name='Portal Per Login User'];
    
    User testUser = UserUtils.createAlumniCommunityUser(testContact, false, true);
    insert testUser;  
    Test.startTest();
    system.runAs(testUser){
      
      UpdateResumeController urc = new UpdateResumeController();
    
        urc.enableEditBreakthrough();
        urc.setLoggedInContactId(testContact.Id);
        String userString = urc.getLoggedInContactId();
        urc.cancelEditBreakthrough();
        urc.addEmploymentHistory();
        urc.addBreakthroughHistory();
        urc.saveBreakthroughHistory();
        urc.enableEditEducation();
        urc.cancelEditEducation();
        urc.addEducationHistory();
        urc.saveEducationHistory();
        urc.enableEditEmployment();
        urc.cancelEditEmployment();
        urc.addEmploymentHistory();
        urc.saveEmploymentHistory();
        PageReference pf = ​urc.deleteRecord();
      
      system.assert(urc.editBreakthrough);        
    }
    Test.stopTest();
  }
}
But it will not let me save due to this error:

Error: Compile Error: Invalid identifier '​urc.deleteRecord'. Apex identifiers must start with an ASCII letter (a-z or A-Z) followed by any number of ASCII letters (a-z or A-Z), digits (0 - 9), '$', '_', or unicode characters from U+0080 to U+FFFE. at line 41 column 28

Any thoughts?
Nithesh NNithesh N
Then Comment out that line 41.
// PageReference pf = ​urc.deleteRecord();

and check the code coverage. Let me know, How much code it is covering.
 
Holly Havelka 10Holly Havelka 10
Here is the updated version of my test class: 
@isTest
private class UpdateResumeControllerTest {

  static testMethod void myUnitTest() {
    
    //RecordType bo = [SELECT Id FROM RecordType WHERE Name = 'Breakthrough Organization'];
    //RecordType alumni = [SELECT Id FROM RecordType WHERE Name = 'Student Alumni'];

    Account testAcc = AccountUtils.createBreakthroughOrgAccount('Breakthrough Alumni Test', true);
    testAcc.Program_Status__c='Inactive';
    update testAcc;
    //insert testAcc;
    
    Contact testContact = ContactUtils.createAlumniContact('MyNew', 'Alumnus1', 'myalumnus1@org.test', testAcc.Id, true);
    //insert testContact;
    
    //Profile testProf = [SELECT Id FROM Profile WHERE Name='Portal Per Login User'];
    
    User testUser = UserUtils.createAlumniCommunityUser(testContact, false, true);
    //insert testUser;  
    Test.startTest();
    system.runAs(testUser){
      
      UpdateResumeController urc = new UpdateResumeController();
    
        urc.enableEditBreakthrough();
        //urc.setLoggedInContactId(testContact.Id);
        String userString = urc.getLoggedInContactId();
        urc.cancelEditBreakthrough();
        urc.enableEditBreakthrough();
        urc.addBreakthroughHistory();
        //urc.saveBreakthroughHistory();
        urc.enableEditEducation();
        urc.cancelEditEducation();
        urc.addEducationHistory();
        //urc.saveEducationHistory();
        urc.enableEditEmployment();
        urc.cancelEditEmployment();
        urc.addEmploymentHistory();
        //urc.saveEmploymentHistory();
        PageReference pf = urc.deleteRecord();
      
      system.assert(urc.editBreakthrough);        
    }
    Test.stopTest();
  }
}
It passes currently but with only 72%.  I commented out 'urc.saveBreakthroughHistory()' because it was throwing another error: System.DmlException: Upsert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, Record Type ID: this ID value isn't valid for the user: : [RecordTypeId]

Class.UpdateResumeController.saveBreakthroughHistory: line 66, column 1
Class.UpdateResumeControllerTest.myUnitTest: line 32, column 1
Nithesh NNithesh N
What is the name of that visualforce page? 
I need the name of it, to write a snippet of code for your test class.
Holly Havelka 10Holly Havelka 10
Hi Nithesh, the name of the visualforce page is: myprofile.
Nithesh NNithesh N
 
       UpdateResumeController urc = new UpdateResumeController();
    
        urc.enableEditBreakthrough();
        //urc.setLoggedInContactId(testContact.Id);
        String userString = urc.getLoggedInContactId();
        urc.cancelEditBreakthrough();
        urc.enableEditBreakthrough();
        urc.addBreakthroughHistory();
        //urc.saveBreakthroughHistory();
        urc.enableEditEducation();
        urc.cancelEditEducation();
        urc.addEducationHistory();
        //urc.saveEducationHistory();
        urc.enableEditEmployment();
        urc.cancelEditEmployment();
        urc.addEmploymentHistory();
        //urc.saveEmploymentHistory();
        PageReference pageRef = Page.myprofile;
        Test.setCurrentPage(pageRef);
        pageRef.getParameters().put('recordId',testContact.Id);
        pageRef.getParameters().put('recordType','breakthrough');

Replace Lines (24 - 41) with the above. 

Try now. 
 
This was selected as the best answer
Holly Havelka 10Holly Havelka 10
Hi Nithesh,  I have made some changes and I am at 74% coverage with this test class:
 
@isTest
private class UpdateResumeControllerTest {

  static testMethod void myUnitTest() {
    
    //RecordType bo = [SELECT Id FROM RecordType WHERE Name = 'Breakthrough Organization'];
    //RecordType alumni = [SELECT Id FROM RecordType WHERE Name = 'Student Alumni'];

    Account testAcc = AccountUtils.createBreakthroughOrgAccount('Breakthrough Alumni Test', true);
    testAcc.Program_Status__c='Inactive';
    testAcc.Portal_Display_Name__c='Breakthrough Alumni Test';
    update testAcc;
    //insert testAcc;
    
    Contact testContact = ContactUtils.createAlumniContact('MyNew', 'Alumnus1', 'myalumnus1@org.test', testAcc.Id, true);
    //insert testContact;
    
    //Profile testProf = [SELECT Id FROM Profile WHERE Name='Portal Per Login User'];
    
    User testUser = UserUtils.createAlumniCommunityUser(testContact, false, true);
    //insert testUser;  
    Test.startTest();
    system.runAs(testUser){
      
      UpdateResumeController urc = new UpdateResumeController();
    
        urc.enableEditBreakthrough();
        //urc.setLoggedInContactId(testContact.Id);
        String userString = urc.getLoggedInContactId();
        urc.cancelEditBreakthrough();
        urc.enableEditBreakthrough();
        urc.addBreakthroughHistory();
        //urc.saveBreakthroughHistory();
        urc.enableEditEducation();
        urc.cancelEditEducation();
        urc.addEducationHistory();
        //urc.saveEducationHistory();
        urc.enableEditEmployment();
        urc.cancelEditEmployment();
        urc.addEmploymentHistory();
        //urc.saveEmploymentHistory();
        PageReference pageRef = Page.MyProfile;
        Test.setCurrentPage(pageRef);
        pageRef.getParameters().put('recordId',testContact.Id);
        pageRef.getParameters().put('recordType','breakthrough');
      
      system.assert(urc.editBreakthrough);        
    }
    Test.stopTest();
  }
  
  static testMethod void deleteRecordTest() {
    
    //RecordType bo = [SELECT Id FROM RecordType WHERE Name = 'Breakthrough Organization'];
    //RecordType alumni = [SELECT Id FROM RecordType WHERE Name = 'Student Alumni'];

    Account testAcc = AccountUtils.createBreakthroughOrgAccount('Breakthrough Alumni Test', true);
    testAcc.Program_Status__c='Inactive';
    update testAcc;
    //insert testAcc;
    
    Contact testContact = ContactUtils.createAlumniContact('MyNew', 'Alumnus1', 'myalumnus1@org.test', testAcc.Id, true);
    //insert testContact;
    
    //Profile testProf = [SELECT Id FROM Profile WHERE Name='Portal Per Login User'];
    
    User testUser = UserUtils.createAlumniCommunityUser(testContact, false, true);
    //insert testUser;  
    Test.startTest();
    system.runAs(testUser){
      
      UpdateResumeController urc = new UpdateResumeController();
    
        urc.enableEditBreakthrough();
        String userString = urc.getLoggedInContactId();
        //urc.setLoggedInContactId(testContact.Id);
        urc.cancelEditBreakthrough();
        urc.enableEditBreakthrough();
        urc.addBreakthroughHistory();
        //urc.saveBreakthroughHistory();
        urc.enableEditEducation();
        urc.cancelEditEducation();
        urc.addEducationHistory();
        //urc.saveEducationHistory();
        urc.enableEditEmployment();
        urc.cancelEditEmployment();
        urc.addEmploymentHistory();
        //urc.saveEmploymentHistory();
        PageReference pf = urc.deleteRecord();
      
      system.assert(urc.editBreakthrough);        
    }
    Test.stopTest();
  }
}

 
Nithesh NNithesh N
Replace Line 89 with this.
PageReference pageRef = Page.myprofile;
Test.setCurrentPage(pageRef);
pageRef.getParameters().put('recordId',testContact.Id);
pageRef.getParameters().put('recordType','breakthrough');
PageReference pf = urc.deleteRecord();

Then we may cross the 75%.  Try it.

Please do not forget to mark this thread as SOLVED and answer as the BEST ANSWER if it helps address your issue.

Best,
Nithesh

 
Holly Havelka 10Holly Havelka 10
Nithesh,

So I did get coverage to 75% with the below test class, but I am wondering if you could answer why the saveBreakthroughHistory; or even the urc.setLoggedInContactId(testContact.Id); lines are not working?  Trying to get better at writing test code coverage. 
 
@isTest
private class UpdateResumeControllerTest {

  static testMethod void myUnitTest() {
    
    //RecordType bo = [SELECT Id FROM RecordType WHERE Name = 'Breakthrough Organization'];
    //RecordType alumni = [SELECT Id FROM RecordType WHERE Name = 'Student Alumni'];

    Account testAcc = AccountUtils.createBreakthroughOrgAccount('Breakthrough Alumni Test', true);
    testAcc.Program_Status__c='Active';
    testAcc.Portal_Display_Name__c='Breakthrough Alumni Test';
    testAcc.Website_Display_Name__c='Breakthrough Alumni Test';
    update testAcc;
    //insert testAcc;
    
    Contact testContact = ContactUtils.createAlumniContact('MyNew', 'Alumnus1', 'myalumnus1@org.test', testAcc.Id, true);
    testContact.Life_Cycle_Is_Alumni__c = true;
    //insert testContact;
    
    Profile testProf = [SELECT Id FROM Profile WHERE Name='Portal Per Login User'];
    
    User testUser = UserUtils.createAlumniCommunityUser(testContact, false, true);
    testUser.Profile = testProf;
    //insert testUser;  
    Test.startTest();
    system.runAs(testUser){
      
      UpdateResumeController urc = new UpdateResumeController();
    
        urc.enableEditBreakthrough();
        //urc.setLoggedInContactId(testContact.Id);
        String userString = urc.getLoggedInContactId();
        urc.cancelEditBreakthrough();
        urc.enableEditBreakthrough();
        urc.addBreakthroughHistory();
        //urc.saveBreakthroughHistory();
        urc.enableEditEducation();
        urc.cancelEditEducation();
        urc.addEducationHistory();
        //urc.saveEducationHistory();
        urc.enableEditEmployment();
        urc.cancelEditEmployment();
        urc.addEmploymentHistory();
        //urc.saveEmploymentHistory();
        PageReference pageRef = Page.MyProfile;
        Test.setCurrentPage(pageRef);
        pageRef.getParameters().put('recordId',testContact.Id);
        pageRef.getParameters().put('recordType','breakthrough');
      
      system.assert(urc.editBreakthrough);        
    }
    Test.stopTest();
  }
  
  static testMethod void deleteRecordTest() {
    
    //RecordType bo = [SELECT Id FROM RecordType WHERE Name = 'Breakthrough Organization'];
    //RecordType alumni = [SELECT Id FROM RecordType WHERE Name = 'Student Alumni'];

    Account testAcc = AccountUtils.createBreakthroughOrgAccount('Breakthrough Alumni Test', true);
    testAcc.Program_Status__c='Inactive';
    update testAcc;
    //insert testAcc;
    
    Contact testContact = ContactUtils.createAlumniContact('MyNew', 'Alumnus1', 'myalumnus1@org.test', testAcc.Id, true);
    //insert testContact;
    
    //Profile testProf = [SELECT Id FROM Profile WHERE Name='Portal Per Login User'];
    
    User testUser = UserUtils.createAlumniCommunityUser(testContact, false, true);
    //insert testUser;  
    Test.startTest();
    system.runAs(testUser){
      
      UpdateResumeController urc = new UpdateResumeController();
    
        urc.enableEditBreakthrough();
        String userString = urc.getLoggedInContactId();
        //urc.setLoggedInContactId(testContact.Id);
        urc.cancelEditBreakthrough();
        urc.enableEditBreakthrough();
        urc.addBreakthroughHistory();
        //urc.saveBreakthroughHistory();
        urc.enableEditEducation();
        urc.cancelEditEducation();
        urc.addEducationHistory();
        //urc.saveEducationHistory();
        urc.enableEditEmployment();
        urc.cancelEditEmployment();
        urc.addEmploymentHistory();
        //urc.saveEmploymentHistory();
        PageReference pageRef = Page.MyProfile;
        Test.setCurrentPage(pageRef);
        pageRef.getParameters().put('recordId',testContact.Id);
        pageRef.getParameters().put('recordType','breakthrough');
        pageRef.getParameters().put('recordType','education');
        pageRef.getParameters().put('recordType','employment');
        PageReference pf = urc.deleteRecord();
      
      system.assert(urc.editBreakthrough);        
    }
    Test.stopTest();
  }
}

 
Nithesh NNithesh N
Nice, Finally we got past the barrier. 
The reasons can be many, As i see some commented code, they might be effecting these Lines i guess. Honestly, It is kinda hard to debug the Controller code (being it so big) and I dont have clear understanding on your config either. I cant debug it on my dev org, since i dont have your config. 

You should consult your dev team about that.  since they have better understanding on functionality and configuration of your Org.  For last time, Try uncommenting some code, and check if the errors Still persist. Sorry for not being able to get you past 80%.  


Please do not forget to mark this thread as SOLVED and answer as the BEST ANSWER if it helps address your issue.

Best,
Nithesh
Holly Havelka 10Holly Havelka 10
Thanks again for all of your help Nithesh!  
Nithesh NNithesh N
Happy to Help.