function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jjvdevjjvdev 

Delayed Unit Test

Is it possible to delay the assertion of something in a unit test?

 

Example:  

1.  0 hour, a lead is created in Salesforce

2.  15 minutes later, Salesforce syncs the lead to a 3rd party app

3.  30 minutes later, the 3rd party app does some stuff

4.  1 hour later, 3rd party app syncs back to Salesforce

 

Did #3 happen as expected?  In the apex test method is possible to write a unit test to check that the 3rd party app performed as expected?  How can this be accomplished?

 

Thanks in advance.

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox
No, test methods can't be paused like this. You can only simulate connections to the third-party system; you can't actually call out to the system to test that method. If you doubt if your remote service would be working correctly, you need to test their API independently.