You need to sign in to do that
Don't have an account?
Sureka
Code coverage for History class
Hi All,
I have written an apex class to display history related list of Lead record. I am using the following code to cover the test method:
LeadHistory leadHist1 = new LeadHistory(LeadId =lead.Id,Field='Created'); insert leadHist1; LeadHistory leadHist2 = new LeadHistory(LeadId = lead.Id,Field='status'); insert leadHist2;
But, I am not able to cover few lines ie. value change in the lead object(oldValue & newValue). Because, oldValue & newValue fields of History object are not writable. Please let me know, if you have any idea on this.
Thanks
Bhuvana
History records are not available in Test Context, so you can not cover such code where you SOQL history records and use it further.