Hello this is the first time i try to write a test class, but i don't understand exactly how i can test if the flow was actually launched. Can someone help me with the test class ? It's only a couple of lines

global class ScheduledContractSend Implements Schedulable {
global void execute(SchedulableContext sc)
        Map<String, Object> Params = new Map<String, Object>();
        Flow.Interview.testcontract flow1 = new 

Test Class :

@isTestprivate class TestScheduledContractSend {
static testMethod void validateScheduledContractSend() {
  • 1
    Assuming this is a Record-Triggered Flow and has DML operations configured within the Flow setup, how about using System.assert() to confirm the database changes as a result of the Flow? Or are you explicitly looking to test if the Flow interview alone was started? Keep in mind startTest & stopTest for this.
    – TSmith
    Feb 24, 2022 at 10:06
  • Yes i just need to see if the flow started ( currently the code coverage is ofc 0% ). In the flow i just have 2 dml operations.
    – Brian23Gt
    Feb 24, 2022 at 10:08

1 Answer 1


This test class worked for me.

private class ScheduledContractSendTest{
    private static void executeTest(){
        ScheduledContractSend obj = new ScheduledContractSend();
  • 1
    this does not test that the flow was launched as there are no asserts that the flow's DML ever occurred. Imagine that someone had commented out the flow1.start() line, the above test would still pass. Another approach is for the flow to pass back an output variable of isSuccess that he schedulable's execute() logs in an queryable Log__c object
    – cropredy
    Feb 24, 2022 at 18:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .