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
SF Beginner 2019SF Beginner 2019 

Queueable test class

Integer counter = UPDTACCOWNRLMT;
                    List<Account> newList = New List<Account>();
                    AccOwnerUpdateQueueble updateJob;
                    for (Integer j=0; j < updtAccLst.size() ;j++){
                        
                        if(j < counter ){
                            newList.add(updtAccLst[j]);
                            }
                        if(j == counter && Limits.getQueueableJobs() == 0){ 
                               newList.add(updtAccLst[j]);
                                updateJob = new AccOwnerUpdateQueueble(newList);
                                ID jobID = System.enqueueJob(updateJob);
                                counter = counter + UPDTACCOWNRLMT;
                                newList.clear();
                           }
                        
                    }
                    
                    if(!newList.isEmpty() && (Limits.getQueueableJobs() == 0)  ){
                             //  system.debug('newList size'+newList.size());
                                updateJob = new AccOwnerUpdateQueueble(newList);
                                ID jobID = System.enqueueJob(updateJob);
                                counter = counter + UPDTACCOWNRLMT;
                                newList.clear();
                           } 
                    
                }

HI,

I need help on queuable test class.

it doesn't cover this portion.

 
ShirishaShirisha (Salesforce Developers) 
Hi,

Greetings!

Please check the sample code for testing Queuable class in the below documents:

https://www.biswajeetsamal.com/blog/queueable-apex-in-salesforce/

https://trailhead.salesforce.com/en/content/learn/modules/asynchronous_apex/async_apex_queueable

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Warm Regards,
Shirisha Pathuri