You need to sign in to do that
Don't have an account?

i have written a test class but i got code coverage 65%, i need more than 75%.
HI Experts,
i have written a test class but i got code coverage 65%, i need more than 75%. kindly help me on this.

Thanks!
Sai
i have written a test class but i got code coverage 65%, i need more than 75%. kindly help me on this.
@istest public class AccConUpd_test { static testMethod void testMethod1() { Account testAccount = new Account(); testAccount.Name='Test Account' ; insert testAccount; Contact cont = new Contact(); cont.FirstName='a1123'; cont.LastName='rest'; cont.Accountid= '0019000001xfaMI'; cont.Employee_Id__c='1091637612'; cont.PAN_Number__c='apgffg'; cont.Working_Days_Per_Week__c=7; cont.Phone='12344'; insert cont; } }
Thanks!
Sai
You don't have to cover a trigger more than 75%. Check below salesforce document.
https://developer.salesforce.com/forums/?id=906F000000092bjIAA
If you really want to cover more than 75%, replace your test class code as below.
Regards
Naveen
Thanks for your help.
But how below lines coverd, can you please suugest on this. ho
Thanks,
Sai
I hope current code coverage is 100%.
As per your screen shot you are code is trying to query Contact records which are child records for Account.
In your previos code you were hardcoded Account record Id when you are creating contact record in test class.
cont.Accountid= '0019000001xfaMI';
But that record id will not exist when you are running test class.May be that erecord id exist in your org, but to see the record of your org in test claas, you should define as Seel all data = true in your test class.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_seealldata_using.htm
Or you should create test data in your test class. you are already doing that.
Let me know if you need more information.
Regards
Naveen
If your problem is solved, mark resective answer as best answer.