Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [asynchronous-testing]

The tag has no usage guidance.

0
votes
0answers
17 views

Please assist me in writing test code for this working piece of code. I am new to testing [duplicate]

I'm stuck at 38%, Its just cover the last part of code(callout portion), I have tried several ways but it just cover till line ' parse_id.nextValue(); ' and after that line it mark as red all the ...
5
votes
2answers
178 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
21 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 ...
5
votes
1answer
220 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
14 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
100 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
388 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
93 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
53 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
803 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
419 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 ...
4
votes
1answer
906 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
46 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
72 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 ...
2
votes
1answer
898 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....