Questions tagged [asynchronous-testing]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
122 views

How to call AsyncApexJob in test class from batch class finish method

here code is passed and code code coverage is not coverd, Please help me any one Test class test.startTest(); // UpdateOppToInitialize.UpdateOppToInitialize(); UpdateOppToInitialize obj = ...
1
vote
1answer
131 views

Queueable Apex in a Before Trigger

I am attempting to create logic that, on Contact record insert or update, will compare the Phone value of the record to another reference object and conditionally populate a checkbox as a result of ...
5
votes
2answers
369 views

Automated testing of chained Queueable jobs in Salesforce

I am currently writing a queueable class for asynchronous processing in my triggers since triggers do not allow callouts. I am going achieve it by calling a class which implements the queueable ...
1
vote
1answer
88 views

Command pattern with batch finish method

To chain a execution of a batchable object, I pass the batchable contructor a ICommand. public interface ICommand { void Execute(); } When testing this approach I create a test ICommand which ...
6
votes
1answer
835 views

How do I test asynchronous Apex?

This is a canonical question and answer developed by the community to help address common questions. If you've been directed here, or your question has been closed as a duplicate, please look through ...
0
votes
0answers
20 views

Developer Console 'Enqueued Time' is not displaying for asynchronous test

I see the 'Enqueued Time' value is not displaying for asynchronous apex tests in the Developer Console. I also saw a few days ago, the date was incorrectly displayed. Date of test was 10th December, ...
1
vote
2answers
207 views

Can Salesforce Platform Events be Relied on as an Async Solution?

Recently I was working on a project where, in order to deal with recursion and governor limits, the previous developer decided to send Platform Events, with the expectation that the very same ...
1
vote
2answers
579 views

Catching exceptions thrown from scheduled job during test execution

I am curious about how to test a scenario when a scheduled job throws an exception. Imagine this is how the schedulable class looks: global class ExceptionScheduler implements Schedulable { ...
1
vote
1answer
112 views

elegant way to test WSDL based continuation callouts

I've read this document about testing Asynchronous Callout from an Imported WSDL. But is there a way to do the same test without instantiate an HttpResponse? because copy-pasting a string with an ...
1
vote
1answer
58 views

Asserting On Asynchronous Behavior

I have a future method with some logic and I have written Test class for that. Calling future method inside test.startTest() and test.StopTest() in test class and asserting the values, in this case i'...
5
votes
2answers
996 views

Disable Parallel Test vs. Always Run Asynchronously in Dev Console - Who wins?

I love to run my tests in the Dev Console with the Always Run Asynchronously checkbox enabled as it saves time. On the other side during our automated Nightly Test run I would like to disable ...
5
votes
1answer
577 views

Queueable class throws Uncommitted Work Pending error in one test, but not others [duplicate]

I noticed yesterday that one of my new test cases was failing, and determined from the logs that I was getting the beloved System.CalloutException: You have uncommitted work pending. Please commit or ...
3
votes
1answer
1k views

How to write test classes for Continuation Controller (using Async WSDL class)

I have implemented Continuation concept with the Asynchronous WSDL class, in a controller of page. So, I facing difficulties while writing test classes for the same. For my requirement I have ...
0
votes
1answer
59 views

Regarding apex class to Test Class

I have A Given Sample Apex Code @HttpGet global static String doGet(){ RestRequest req = RestContext.request; RestResponse res = RestContext.response; try{ ...
0
votes
0answers
102 views

Tests passing with 0% coverage

I'm pretty new to apex. My test classes are passing. But the class is showing zero % coverage (none of the lines in the actual class were hit (highlighted blue)... which does not make sense.) Any ...
3
votes
1answer
1k views

Testing multiple asynchronous processes

I have a test that for it's data setup I need to fire multiple asynchronous processes. I have a suspicion, that they do not finish sequentially one after another. I think Test.startTest()/Test....