You need to sign in to do that
Don't have an account?
Bhupesh Kumar 14
Queueable future method
Hi,
I'm facing one issue while executing tests for Queueable future method. When I runing my code using debugging tool on developer console then my code is running successfully. however test is failing. After analysins this it is found that the test class is not able to execute the future method which is being called in Queueable class. Anyone have any idea?
I'm facing one issue while executing tests for Queueable future method. When I runing my code using debugging tool on developer console then my code is running successfully. however test is failing. After analysins this it is found that the test class is not able to execute the future method which is being called in Queueable class. Anyone have any idea?
public class CustomClass { public static void calloutServiceMethod(List<InputParams> inputParams) { cuatomConfig__c configObject = getConfig(inputParams[0].configName); System.enqueueJob(new QueueableCall(configObject, inputParams[0].Ids)); } @Future(callout=true) private static void postCall(String configName, List<Id> ids) { //some code here that is not being called } class QueueableCall implements System.Queueable, Database.AllowsCallouts { private cuatomConfig__c configuration; private List<id> IDS; public QueueableCall(cuatomConfig__c Configuration, List<Id> ids){ this.configuration = Configuration; this.IDS = ids; } public void execute(QueueableContext context) { String CName = configuration.Name__c; postCall(CName, IDS); } } public class InputParams { public List<Id> Ids; public String configName; } }
Did you try initiating this test execution which has the @future method call between Test.start() and Test.stop()?
https://trailhead.salesforce.com/en/content/learn/modules/asynchronous_apex/async_apex_future_methods
Yes, My test class is like below: