How do you cover the logic of asynchronous methods in test class?



How do you cover the logic of asynchronous methods in test class?..

Answer / Aradhna Sharma

To test the logic of asynchronous methods in Salesforce Apex, you can use Future methods or Queueable Apex. These allow you to execute code asynchronously and then wait for the results in your test method using the Test.startTest() and Test.stopTest() methods. You should also consider using the @future annotation on test methods that utilize asynchronous methods.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Salesforce Interview Questions

What are the differences between 15 and 18 digit record ids?

1 Answers  


How do you prevent closed Opportunities from being updated by a non-System Administrator profile declaratively?

1 Answers  


How can we enable visualforce editor? : salesforce visualforce

1 Answers  


We are not providing some of fields in .csv file which are required in filed level. What happens if we try to insert records into salesforce through data loader?

1 Answers  


How can we subscribe to an event in lightning component?

1 Answers  


Does salesforce count calls to system.debug() against the code coverage?

1 Answers  


How many records can a select query return?

1 Answers  


What are governor limits?

1 Answers  


How many types of email templates can be created in salesforce?

1 Answers  


Can we create a new User without Role and Profile?

1 Answers   Cognizant,


How to display error messages in the visualforce page ?

1 Answers  


What are the different ways to Share a record?

1 Answers   Cognizant,


Categories