0

we have developed one solution in Salesforce in the developer sandbox the solution contains the Apex Class,Trigger, Custom Objet and LWC. Eventually, We are planning to release this solution as a changeset in the production environment. As it contains Apex Class and Trigger majorly, we need to create Test classes as well. But somehow when we are creating Test Classes in our sandbox or partial sanbox we are not able to view the code coverage even the test passes successfully.

  1. Following are the Apex Test Execution Options set in both Sandbox and Partial Sandbox

enter image description here

  1. I tried by clearing the test history too but no luck

  2. Here is the code of Test Class and OutboundDictionary is the class name

    @isTest public class OutboundDictionaryTest {

     @TestSetup
     static void makeData(){
    
         List<sObject> csvMappingList = Test.loadData(CSVSFMapping__c.SObjectType, 'CSVMappingFile');
         List<Account> accounts = new List<Account>();
         for(Integer i =0;i<5;i++){
    
             Account acc = new Account();
             acc.FirstName = 'First Name '+i;
             acc.LastName='Last Name '+i;
             acc.PersonEmail='accountinfo'+i+'@gmail.com';
             accounts.add(acc);
         }
    
         insert accounts;
         List<Opportunity> opptyList = new List<Opportunity>();
    
    
         for(Integer i =0;i<5;i++){
    
             Opportunity oppty = new Opportunity();
             oppty.accountId = accounts[i].Id;
             oppty.Address_Country__c = 'Canada';
             oppty.Institution_Type__c ='College';
             oppty.Citizenship_Status__c ='Canadian Citizen';
             oppty.CloseDate=Date.today();
             oppty.Country_of_Citizenship__c='Canada';
             oppty.Date_of_Birth__c =Date.newInstance(1985, 1, 17);
             oppty.Email_Address__c='opptyinfo'+i+'@gmail.com';
             oppty.Expected_Start_Date__c=Date.today();
             oppty.Gender__c ='Female';
             oppty.Media_Group__c='Co-enrolment';
             oppty.Media_SubGroup__c='Academy of Design Sign';
             oppty.Name ='oppty name '+i;
             oppty.StageName='Applicant';
             oppty.Telephone__c='909090909'+i;
             opptyList.add(oppty);
         }
    
         insert opptyList;
    
    
         List<SyncInfo__c> syncInfoList = new List<SyncInfo__c>();
         for(Integer i=0;i<opptyList.size()-1;i++){
    
             SyncInfo__c syncInfo = new SyncInfo__c();
             syncInfo.ObjectId__c=opptyList[i].Id;
             syncInfo.ObjectName__c='Opportunity';
             syncInfo.Status__c = 'IDLE';
             syncInfo.EventType__c='UPDATED';
    
             syncInfoList.add(syncInfo);
    
    
         }
    
         insert syncInfoList;
     }
    
     @isTest
     static void testOutbound(){
    
         List<Account> accounts = [SELECT ID FROM Account];
         List<Opportunity> oppty = [SELECT ID FROM Opportunity];
    
    
    
    
         OutboundDictionary outbound = new OutboundDictionary();
         outbound.addHeader();
    
    
    
    }
    

    }

0% code coverage

enter image description here

1 Answer 1

0

Goto setup -> Develop -> Apex Test Execution and click the Options button.

Make sure "Store Only Aggregated Code Coverage" is UNCHECKED

OR

please check

Not showing Test code coverage on developer console

2
  • It's already deselected see the screenshot in the question
    – Hunt
    Jul 22, 2020 at 12:31
  • 1
    I enabled it and the disabled it and now it is working
    – Hunt
    Jul 30, 2020 at 12:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .