Salesforce Asked on November 23, 2021
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.
Apex Test Execution Options
set in both Sandbox
and Partial Sandbox
I tried by clearing the test history too but no luck
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
Goto setup -> Develop -> Apex Test Execution and click the Options button.
Make sure "Store Only Aggregated Code Coverage" is UNCHECKED
OR
please check
Answered by Uday on November 23, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP