For the purpose of testing some code, I want to be able to simulate a batch job run and abort in the middle of execution. How can I do this from an apex test? I tried using a boolean flag to abort from within the job, but I when I check the AsyncApexJob table, it does not show that any job was aborted.
Can someone please provide me with any suggestions to do this? Thank you.