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
PARISE RAVIKIRANPARISE RAVIKIRAN 

I bolded the error line pls check System.QueryException: List has no rows for assignment to SObject Class.LeadTriggerUtilityTest.testsetLeadSourceforPartnerGeneratedLeads: line 1642, column 1


    /*************************************************************
     * Method Name  : testsetLeadSourceforPartnerGeneratedLeads
     * Description  : Test Method for the setLeadSourceforPartnerGeneratedLeads() and createCampaignMembersForPartnerLeads() function in LeadTriggerUtilityCls.cls
     * Return Type  : n/a
     * Parameters   : none
     **************************************************************/
    static testMethod void testsetLeadSourceforPartnerGeneratedLeads(){
    
        Id RecordTypeIdLeadDirect = Schema.SObjectType.Lead.getRecordTypeInfosByName().get('Direct').getRecordTypeId();
        List<Lead> leadCreateList = new List<Lead>();
        List<LeadShare> leadShareList = new List<LeadShare>();
        Test.startTest();
        Lead testLead = CreateLead('John' + System.now().Format('hms'), 'Doe' + System.now().Format('hms'), '', 'Comity1 Designs', 'United States');
        leadCreateList.add(testLead);
        
        Lead testLead2 = CreateLead('John' + System.now().Format('hms'), 'Doe' + System.now().Format('hms'), '', 'Comity1 Designs', 'United States');
        testLead2.email = 'testemailduplicate@partner.com';
        testLead2.RecordTypeId = RecordTypeIdLeadDirect;
        testLead2.Status = '1-New'; 
        leadCreateList.add(testLead2);
        
        Lead testLead3 = CreateLead('John' + System.now().Format('hms'), 'Doe' + System.now().Format('hms'), '', 'Comity1 Designs');
        testLead3.Country = 'United States';
        testLead3.State = 'GA'; 
        leadCreateList.add(testLead3);
        
        insert leadCreateList;
        
        User partnerUser = [Select id from User where email = 'puser000@testlead.com'];
        
        LeadShare ldShare = new LeadShare(LeadId = testLead.Id, LeadAccessLevel = 'Edit', UserOrGroupId = partnerUser.Id);
        leadShareList.add(ldShare);
        
        LeadShare ldShare2 = new LeadShare(LeadId = testLead3.Id, LeadAccessLevel = 'Edit', UserOrGroupId = partnerUser.Id);
        leadShareList.add(ldShare2);
        
        insert leadShareList;
        
        System.runAs(partnerUser){
            Lead newLeadRec = CreateLead('John' + System.now().Format('hms'), 'Doe' + System.now().Format('hms'), '', 'Comity1 Designs');
            newLeadRec.Country = 'United States';
            newLeadRec.State = 'GA';
            newLeadRec.LeadSource = 'Partner';
            newLeadRec.Lead_Source_Most_Recent_Picklist__c = 'Test Value';
            insert newLeadRec;
            
            Lead updateLead2 = [Select id, email from Lead where id =: testLead3.Id];
            updateLead2.email = 'testemailduplicate@partner.com';
            updateLead2.Lead_Source_Most_Recent_Picklist__c = 'Test Value';
            try{
                LeadTriggerControl.executeBeforeUpdate = true;
                update updateLead2;
            }
            catch(Exception excep){
                Boolean expectedExceptionThrown =  excep.getMessage().contains('Please submit your Leads to DocuSign as') ? true : false;
                //System.AssertEquals(expectedExceptionThrown, true, excep);
            }
        }
        Test.stopTest();
    }
    
Sai PraveenSai Praveen (Salesforce Developers) 
Hi,

Did you create any user with email "puser000@testlead.com" in your test class.
Even though you have the user in your salesforce org with that email will not retrive in test class as you wont be able to access the data in test class. You need to create a user with some email id and use that email id in test class filter.

Let me know if you face any issues.

If this solution helps, Please mark it as best answer.

Thanks,