---
schema_version: "1"
id: 0a1dc0ce0a26e97e38c32aa8ff67f5488b0eb001ea48e5f855374328b8367668
title: Testing a Flow with a Scheduler Source
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/munit/2.3/test-flow-with-scheduler-cookbook.md
canonical_url: https://docs.mulesoft.com/munit/2.3/test-flow-with-scheduler-cookbook
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 2632696657bddffa9b30991ecede79ec5c6abce5b51865623daa2af058fc5ffd
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
---
product: MUnit
version: 2.3
---

# Testing a Flow with a Scheduler Source

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Assume that you want to both test the following flow triggered by a Scheduler component and validate
that your flow is being triggered correctly:

```xml
<flow name="schedulerFlow">
    <scheduler>
        <scheduling-strategy >
            <fixed-frequency frequency="10" timeUnit="SECONDS"/>
        </scheduling-strategy>
    </scheduler>
    <set-payload value="#['test poll']"/>
</flow>
```

1.  Enable flow sources.  
    Because MUnit does not start any of the flow sources (such as triggers or listeners), you must
    configure which flow sources start for your tests.

    In this example, you enable the flow that contains the Scheduler:

    ```xml
    <munit:test name="test-schedulerFlowTest">
        <munit:enable-flow-sources>
            <munit:enable-flow-source value="schedulerFlow"/>
        </munit:enable-flow-sources>
    </munit:test>
    ```

2.  Verify that flow execution is triggered by the Scheduler.  
    To verify that the processors inside your flow are being triggered, use the
    `munit-tools:verify-call` processor.

    Wrap `munit-tools:verify-call` inside an `until-successful` to shorten processing time when the
    Scheduler is not operating when you want to test.

    The following example validates three times that the payload was executed at least once during
    the test.

    ```xml
    <munit:execution>
        <until-successful maxRetries="3" millisBetweenRetries="100">
            <munit-tools:verify-call processor="set-payload" atLeast="1">
                <munit-tools:with-attributes >
                    <munit-tools:with-attribute whereValue="#['test poll']" attributeName="value" />
                </munit-tools:with-attributes>
            </munit-tools:verify-call>
        </until-successful>
    </munit:execution>
    ```

## See Also

- [Enable Flow Sources](https://docs.mulesoft.com/munit/2.3/enable-flow-sources-concept)

- [Verify Event Processor](https://docs.mulesoft.com/munit/2.3/verify-event-processor)
