Skip to main content

@Srikanth Ganapavarapu I'm curious about the testing expectations of Finalizers. From what I've seen in examples and in my own implementation of the interface we should expect the Queueable.execute() and the Finalizer.execute() methods to complete synchronously between the Test.start() and Test.stop() methods of a test method. What I'm curious about is if we should expect all chained Queueables and Finalizers to complete synchronously when run between the start() and stop() Test methods? Should we write tests like the one in this example? https://developer.salesforce.com/blogs/2020/01/learn-moar-in-spring-20-implementing-promises-with-transaction-finalizers.html

Or should we use the Test.isRunningTest() method to stop the Finalizer from enqueuing the next Queueable and just assume that it will get enqueued like we would if we wrote a Queueable that enqueued a Queueable, like the docs state here? https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_queueing_jobs.htm

6 comments
  1. Sep 12, 2022, 8:50 PM

    @Drew Snyder 

    I haven't had a chance to validate this behavior. It has been a while that I looked into Transaction Finalizers. As a first step, I'll schedule sometime in last week of Sep (this month) to understand what is the current baseline behavior we have. I'll then review it with our PM @Daniel Ballinger. I'll try to get back to you by Oct 15th. 

0/9000