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

formula field is not getting executed in test class
formula field is not getting executed in test class, due to this condition is fails in apex class. the test class is below
If formula field is Null then other field update operation will also be failed .
another it will not be cover test code coverage in apex class
in apex class i've used condtion like ex.
@isTest(seealldata=false) public class CreateOpty_Phyothersvcs_WPatsBatchTest { static testMethod void test() { patient__C pat=new patient__C(); pat.name=test; cost__C=100; insert pat; job__c jb = new job__c(); jb.name__c=test; patient__C.id=pat.id; //some field insert jb; //formula field in job object is patient_cost__c=patinet__r.cost__C system.debug(''+jb.patient_cost__c); //it showing null //when i write query like List<job__c> job = new List<job__c>(); job=[select id patient_cost__c from patient_cost__c where id=:jb.id]; system.debug(''+job[0].patient_cost__c); //it showing 100 correct as required // but i want here 100 system.debug(''+jb.patient_cost__c); //its still showing nulli've some formula field and another field update based on that formula field and thus
If formula field is Null then other field update operation will also be failed .
another it will not be cover test code coverage in apex class
in apex class i've used condtion like ex.
public class MySampleApexClass { //some code List<job__c> jb=new List<job__c>(); job=[select id,patient_cost__c from job__C where //some condition]; for(job__c job : jb ) { if(job.patient_cost__c<=50000) //this will fails(not cover in test class) due to formula field { //some code with different operation } } }
In your test class check line number 12.I am confused how your test class got saved.
Replace with
Best Regards,
Amit Ghadage.
Yes this class is just an example here due to this it has error. My original class is too big due to this i put here example class. My original class is correct not such small mistake.
i have problem in formula field not executed and due to this other field will not update.