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
Liron CohenLiron Cohen 

time based workflow in test class

Hi.
I couldn't find any documentation for this, so appreciate your assitenace. 

Assume I have time based workflow which scheduled for future (assume 7 days after the event), and then it update the record.
If it will be scheduled from test class, does the workflow update action will be process during the test? Is this functionality was changed in any of the latest realese?

I can see it does running (according to debug log), but see also old questions people asking how they can test time based workflow.

Thanks
Best Answer chosen by Liron Cohen
NagendraNagendra (Salesforce Developers) 
Hi Liron,

Yes,you are right it doesn't run,whenever you want to run the unit tests it is meant for code,as time-based workflow is related to configuration part it doesn't run in unit testing.

Please find the below which can successfully run in unit testing.
  • Batch Apex
  • Schedule Apex
  • Queueable apex
  • Future Methods etc.
Please mark this as solved if the information helps so that it gets removed from the unanswered queue which results in helping others who are really in need of it.

Best Regards,
Nagendra.P