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
Abraham kumarAbraham kumar 

Overall Code Coverage is 74%

Hi All,

I want to deploy below trigger and test class in production which has 87% code coverage. But while i validate Im getting CODE COVERAGE ERROR .My overall code coverage is 74 % i need 1 more % to deploy Please help me with what needs to be done to get 1%. to deploy
trigger ContactTrig2 on Account(after update) {
List<Contact> ListContact = new List<Contact>();
Set<ID> acctIds = new set<ID>();
    for(Account acct : trigger.new) {
        if(Trigger.oldMap.get(acct.id).Name != acct.Name){
             acctIds.add(acct.Id);
        }
    }
    if(acctIds.size() > 0){
        for(Contact con : [SELECT id,Email,FirstName,LastName,phone,Title__c,Account.Name,status__c, AccountId FROM Contact WHERE AccountId IN : acctIds AND RecordTypeid = '012D0045000BgasT']){
          WebServiceCallout.sendNotification(con.Id,con.Email,con.FirstName,con.LastName,con.phone,con.Title__c,con.Account.Name,con.status__c);
        }
    }
   
}

Test class:-
will increasing code coverage of below test class which is 87% solve it?please let me know
@istest
public class Contacttrig2TestClass{
@istest
static void Accountcreate(){
Account a =new Account();
a.Name = 'abc';
a.Type = 'Agency';
a.ShippingStreet = 'test';
a.ShippingCity = 'test';
a.ShippingPostalCode = 'tw31aq';
insert a;
a.Name = 'abcd';
update a;
contact c =new contact();
c.Email = 'abc@wipro.com';
c.Salutation = 'Mr';
c.FirstName = 'Test';
c.LastName = 'Tester';
c.type__c = 'Agency';
c.status__c= 'Active';
insert c;
    }
    }

Thanks
Abraham 
Amit Chaudhary 8Amit Chaudhary 8
Please try to inclease the code coverage of below class. I hope that will increase over all code coverage.
WebServiceCallout

You can install below App Exchange product to see each test class code coverage .
https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000DXzlpEAD

Above App will give you code coverage if each class. Then please work on that apex class where code coverage is less then 75

NOTE:- For deployment your overall Code coverage should be 75%. In this it will include all Apex classes and Trigger in your org.
sandeep@Salesforcesandeep@Salesforce
Hi abraham,

You should either increase code coverage of this class "WebServiceCallout" or check on developer console to run all classes  & check which one is covering less increase that one.

Thanks 
Sandeep Singhal