+ Start a Discussion

Delayed Unit Test

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



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) 
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.