---
schema_version: "1"
id: e7d69a94454224926ccbc41749027a289f3b1fd7b92287c675d444f45fdf39a3
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/3.6/test-flow-with-scheduler-cookbook.md
canonical_url: https://docs.mulesoft.com/munit/3.6/test-flow-with-scheduler-cookbook
source_site: docs.mulesoft.com
content_type: documentation
content_hash: ccc5a4f0fd9a17c7bd628131f855ca6f73bf4e6ec7fabada5b9d38a0395f8996
description: MuleSoft Documentation Site
release: "3.6"
latest: false
---
---
product: MUnit
version: 3.6
---

# Testing a Flow with a Scheduler Source

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

![logo acb active](/mulesoft/current/en-us/_/img/icons/anypoint-code-builder.svg "Anypoint Code Builder")Anypoint Code
Builder

![logo studio active](/mulesoft/current/en-us/_/img/icons/studio.svg "Anypoint Studio")Anypoint Studio

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/3.6/enable-flow-sources-concept)

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