Stack Exchange Network

Stack Exchange network consists of 174 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

Questions tagged [asynchronous-testing]

The tag has no usage guidance.

1
vote
1answer
18 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
120 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
11 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
72 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
355 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
80 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
51 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
736 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
368 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 ...
0
votes
0answers
40 views

Field filter throwing error in test class

I' ve one object Patient service and job is look up field on same object. field job has look up filter enable as below. in my test class, i'm creating my test data like; @IsTest public class test1 ...
4
votes
1answer
866 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
61 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
841 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....