You need to sign in to do that
Don't have an account?
krishna 2619
Need help in test coverage for class which looks into apex jobs
Method 1
joblst = [select ApexClassId, Id, JobItemsProcessed, JobType, Status, NumberOfErrors, MethodName,CreatedDate from AsyncApexJob where ApexClass.Name ='bthProcess' Order by CreatedDate DESC LIMIT 1]; if(joblst .size()>0){ if(joblst [0].status == 'Processing'){ BatchinProcess = true; this.lastBatchRunDate=String.valueOf(joblst [0].CreatedDate); this.lastBatchRunStatus=joblst [0].status; } else if(ascjoblst[0].status == 'Completed'){ Process__c setting= _Process__c.getall().values(); if(setting.obj__c==this.selectedObj){ BatchinProcess = false; }
Method 2:
Database.SaveResult[] Updatelst = Database.update(Records, false); for(Integer i=0; i < Updatelst.size(); i++) { if(Updatelst.get(i).isSuccess()) { Id errorId = Updatelst.get(i).getId(); } if(!Updatelst.get(i).isSuccess()) { Database.Error error = Updatelst.get(i).getErrors().get(0); if(existngrecIds.containsKey(objlst.get(i).Id)){ deleterec.add(existngrecIds.get(objlst.get(i).Id)); } Error_Record__c errRec = new Error_Record__c(); errRec.Error_Message__c = error.getMessage(); errRec.Record_Id__c = objlst.get(i).Id; errRec.Object_Name__c = ObjName; insrtlst.add(errRec); }
Am not able to conver the test class for above methods
The developer community recommends providing any attempts/code you've started, any errors you're getting, or where exactly you're struggling in achieving this while posting a question.