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
BarracksBarracks 

Test Class for apex class which calls a flow.interview with Schedulable

Hi Guys,

I was wondering if someone can help me, I'm trying to run a test class for a simple Apex class the calls a Flow Interview.
It also implements schedulable.

How do I write a test class for this? I could not find any documentation for this sort of use cases.
 
global class TestHelloWorld implements Schedulable{

   global void execute(SchedulableContext sc) {
      Map<String, Object> params = new Map<String, Object>();
Flow.Interview.ReturnHelloWorld helloWorldFlow = new Flow.Interview.ReturnHelloWorld(params);
helloWorldFlow.start();
   }

}

 
BarracksBarracks
Karthik, thank you for your response.

I don't have a controller and I'm not using batch.

I tried copying your code but it said 'Variable does not exist: query'
BarracksBarracks
Thanks Karthik.

I still cannot use it, I don't know how.
The code I provided in the original post is the entire code so I'm not sure what you mean by ' you have to correct based on your needs..'.
anyway, I get this error: "Line 7 Varaible dos not exist: ReturnHelloWorld"
although the Flow is called ReturnHelloWorld and it is activated.