> For the complete documentation index, see [llms.txt](https://docs-embed.anyflow.jp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-embed.anyflow.jp/release/solution-test.md).

# テスト

## 概要

テスト機能は、ソリューションやウィザードが設計者の期待通りの動作をするのかをテストすることができる機能です。

<figure><img src="https://files.readme.io/1aca688-solution_test.png" alt="3152"><figcaption><p>ソリューションテストの結果画面</p></figcaption></figure>

## ソリューションをテストする

{% hint style="warning" %}

### ヒント

テストをする前に、[ソリューションエディタ](/solution-editor/about.md)でロジックの構築と、[ウィザードエディタ](/wizard-editor/about.md)でソリューションで必要なエンドユーザー変数やコネクションをスクリーンに配置してテストを行いましょう。
{% endhint %}

ソリューションをテストするためには、ソリューションタブの右上の **テストボタン**を押します。

<figure><img src="https://files.readme.io/41660e3-solution-test.png" alt=""><figcaption></figcaption></figure>

テストボタンを押下すると、以下のスクリーンショットのようなウィザードが表示されます。\
この画面で表示されているウィザードは、ウィザードエディターでデザインしたものが表示され、エンドユーザーの目線にたって、ソリューションまたはウィザードの動作をテストできます。

<figure><img src="https://files.readme.io/7a450b3-solution-test-wizard.png" alt="1673"><figcaption><p>ソリューションテストのウィザード</p></figcaption></figure>

ソリューションには、実行の起点となるトリガーが存在します。\
ソリューションエディターで設定したトリガーが発火するように、トリガーで設定したサービスのデータを更新するなどして、テストを実行します。

### テストの待機について

トリガーが[ポーリングトリガー](/solution-editor/triggers/incoming/polling-triggers.md)の場合、対象のサービスで新しいデータが検知されるなど、トリガーの条件を満たすまでテストは待機します。

待機中は数秒おきにデータを取得しますが、「今すぐデータを取得する」 ボタンを押下することで最新のデータをすぐに取得することができます。

<figure><img src="https://files.readme.io/63f96ae-solution-test-waiting.png" alt="1652"><figcaption><p>ポーリングトリガーのテストを待機している画面</p></figcaption></figure>

{% hint style="info" %}

#### テスト実行時のデータ取得件数

ポーリングトリガーを使用したソリューションをテスト実行した場合、トリガーが取得するデータは **1件のみ** に制限されます。

これは、初回実行時などに大量のデータが存在する場合に、その件数分のジョブが大量生成されてしまうことを防ぐための仕様です。

また、テスト実行時はポーリングが複数回繰り返されることはなく、1回のポーリングのみ実行されます。

本番実行時は、取得できたデータ全件を処理します。
{% endhint %}

この他にも、トリガーが[Webhookトリガー](/solution-editor/triggers/outgoing/webhook.md)や[Requestトリガー](/solution-editor/triggers/outgoing/request-triggers.md)の場合、テストでは実際に指定のエンドポイントに対しデータを送信する必要があります。

## テスト結果を確認する

トリガーが発火し、ソリューションが実行されるとテスト結果画面に自動的に遷移します。\
入力値タブ、出力値タブには、各ステップで内部的に使用されたJSONが表示されています。

### エンドユーザー変数の値を確認する

エンドユーザーから入力された値を確認するためには、下記のスクリーンショットのようにエンドユーザー変数ウィンドウで確認します。

赤枠で囲っている部分は、実際にエンドユーザーから入力され、ソリューションに渡された値です。

<figure><img src="https://files.readme.io/56e83ea-test-end-user-variable.png" alt="" width="563"><figcaption></figcaption></figure>

### 入力値タブ

入力値タブには、選択しているステップの入力値の内容を表示しています。

<figure><img src="https://files.readme.io/8425c7c-test-input.png" alt="1197" width="563"><figcaption><p>入力値タブ</p></figcaption></figure>

### 出力値タブ

出力値タブには、ステップのアプリのAPIのレスポンスの値が表示されています。

<figure><img src="https://files.readme.io/f40be0f-test-outout.png" alt="1174" width="563"><figcaption><p>出力値タブ</p></figcaption></figure>

### デバッグタブ

デバッグタブには、エラーになった際のエラーメッセージ等が表示されます。

<figure><img src="https://files.readme.io/5cd8eb7-test-debug.png" alt="1159" width="563"><figcaption><p>デバッグタブ</p></figcaption></figure>

## テストが失敗した場合

テストが失敗した場合、下記のスクリーンショットのように、エラーになったステップが赤枠で表示され、デバッグタブに赤文字でエラーメッセージが表示されます。

<figure><img src="https://files.readme.io/64bfbf5-test-error.png" alt="1680"><figcaption><p>テストが失敗した結果</p></figcaption></figure>

入力値や出力値、エラーメッセージを見ながらソリューションの組み方に問題がないかを確認します。\
エラーになったアプリのエラーメッセージを検索するなどして、ソリューションの組み立てとテストを繰り返しソリューションを構築していきます。

{% hint style="success" %}

### ヒント

お客様でトライアンドエラーの結果、解決できないエラーについては、

Anyflowのカスタマーサクセスチームが解決まで伴走いたします👍
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs-embed.anyflow.jp/release/solution-test.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
