---
schema_version: "1"
id: 5b2f9585773527e79725300187b5e5b03a50ef9037e5ba9a7c8cdd3e6440b82f
title: スケジューラー提供元を使用したフローのテスト
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/munit/2.3/test-flow-with-scheduler-cookbook.md
canonical_url: https://docs.mulesoft.com/jp/munit/2.3/test-flow-with-scheduler-cookbook
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 0f2b0ae4ef077f32bd70f3cd656a612d6d6ee8aecf09f501e3e2a8b90e8aaac7
description: MuleSoft Documentation Site
release: "2.3"
latest: false
---
# スケジューラー提供元を使用したフローのテスト

Scheduler コンポーネントによってトリガーされる次のフローをテストし、フローが正しくトリガーされていることを検証するには、次の手順を実行します。

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

1. フロー提供元を有効にします。  
    MUnit ではフロー提供元 (トリガーやリスナーなど) が起動されないので、テスト用にどのフロー提供元を起動するかを設定する必要があります。
    
    次の例では、Scheduler を含むフローを有効にします。
    
    ```xml
    <munit:test name="test-schedulerFlowTest">
        <munit:enable-flow-sources>
            <munit:enable-flow-source value="schedulerFlow"/>
        </munit:enable-flow-sources>
    </munit:test>
    ```
2. Scheduler によってフロー実行がトリガーされることを検証します。  
    フロー内のプロセッサーがトリガーされていることを検証するには、​`munit-tools:verify-call`​ プロセッサーを使用します。
    
    テストしたいタイミングで Scheduler が動作しない場合は、​`until-successful`​ 内部に ​`munit-tools:verify-call`​ をラップして、処理時間を短縮します。
    
    次の例では、テスト中にペイロードが 1 回以上実行されることを 3 回検証します。
    
    ```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>
    ```

## [](#関連情報)関連情報

- [Enable Flow Sources](https://docs.mulesoft.com/jp/munit/2.3/enable-flow-sources-concept)
- [Verify イベントプロセッサー](https://docs.mulesoft.com/jp/munit/2.3/verify-event-processor)