You need to sign in to do that
Don't have an account?
mhitt
help with code coverage for deployment
Hi friends,
I am trying to deploy code to prod, but I am running into issues getting my test class to reference my code to provide the required coverage to deploy. Can I please have some help? When I run the test, it passes in Apex Test Execution, but the code coverage is still showing 0%. It's like I'm missing something to connect the Test to the Class.
Apex Class
Test Class
Thank you in advance,
I am trying to deploy code to prod, but I am running into issues getting my test class to reference my code to provide the required coverage to deploy. Can I please have some help? When I run the test, it passes in Apex Test Execution, but the code coverage is still showing 0%. It's like I'm missing something to connect the Test to the Class.
Apex Class
public class eVolveServiceRequestClass { public id eVolveServiceRequestId {get;set;} public List<ESR_Signing_Party__c> geteVolveServiceRequestComp(){ List<ESR_Signing_Party__c> esp; esp = [SELECT Name__c, Phone__c, Email__c, Country__c, Time_Zone_PL__c FROM ESR_Signing_Party__c WHERE eVolve_Service_Request__c =: eVolveServiceRequestId AND RecordTypeId =: '0122C00000091NsQAI']; return esp; } }
Test Class
@isTest private class TestEvolveServiceRequest { @isTest static void setupTestData() { Account acc = new Account( Name = 'Test Account'); insert acc; Contact con = new Contact( FirstName = 'Test', LastName = 'Contact', AccountId = acc.Id ); insert con; eVolve_Service_Request__c esr = new eVolve_Service_Request__c( Signing_Party_Type__c = 'Seller', Status__c = 'New', Contact_Name__c = con.Id, Signing_Date_Requested_Start__c = system.today()+5); insert esr; ESR_Signing_Party__c sp = new ESR_Signing_Party__c(Name__c = 'Test Party', Phone__c = '123-456-7890', Email__c = 'test@email.com', Country__c = 'United States of America', State__c = 'TX', Time_Zone_PL__c = 'Acre Time (UTC-5)', eVolve_Service_Request__c = esr.Id, RecordTypeId = '0122C00000091NsQAI'); insert sp; } @isTest static void testcheckeVolveServiceRequestClass() { ESR_Signing_Party__c sp = [select id from ESR_Signing_Party__c where Phone__c = '123-456-7890'][0]; try { insert sp; } catch(Exception ex) { system.assert(ex.getMessage().contains('The ID is already attached to the record via GAB connector')); } } }
Thank you in advance,
All Answers
https://salesforce.stackexchange.com/questions/244794/how-do-i-increase-my-code-coverage-or-why-cant-i-cover-these-lines
75 %
https://salesforce.stackexchange.com/questions/24165/why-is-75-code-coverage-required-in-salesforce/24167#24167
You can Increase your code coverage based on the above suggestions.
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.