You need to sign in to do that
Don't have an account?
Mario C
Test Class for Queueable Apex Chain passing a list ids
Hi,
I've implemented queueable apex on 2 chained classes: class a and class b.
In Class A, when the class 2 gets invoked a list gets also passed into class b.
while the test cflass for class a is fine, I am unable to get coverage for class 2.
Any ideas about how to write the test class for this scenario?
I've implemented queueable apex on 2 chained classes: class a and class b.
In Class A, when the class 2 gets invoked a list gets also passed into class b.
while the test cflass for class a is fine, I am unable to get coverage for class 2.
Any ideas about how to write the test class for this scenario?
public class classA implements Queueable, Database.AllowsCallouts { public void execute(QueueableContext context) { do something... List<id> myList; System.enqueueJob(new blassB(myList); ....
When you make a test class, is best recommended that you test only one "feature" at time, to guarantee that your chained class is working regardless of who invoked it. So, the best practice is to make a separate test method to test only the class 2.
If you have to test the chained flow, be sure that your test code is between Test.startTest() and Test.stopTest().
Thanks for your response.
I am testing the second class creating some dummy records and list of ids, but I get a Class List<Id> must implement the Queueable interface error...any idea?
Your example Class A implements the Queueable Interface but has no constructor. Does your class B implement the queueable interface and have a constructor?