หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
Applies to: Azure Logic Apps (Consumption + Standard)
Test your workflow without touching production by setting up and returning mock outputs, or static results, from your workflow operations. You don't have to call your live apps, data, services, or systems.
When you set up mock outputs, you can:
- Test different action paths based on various conditions.
- Force errors to check failure handling.
- Provide specific message response bodies.
- Skip steps that you don't want to run.
Setting up mock outputs from an action doesn't run that action in production, but returns the test output instead.
For example, if you set up mock outputs for the Outlook 365 send mail action, Azure Logic Apps returns the mock outputs that you provided, rather than send an email.
In this guide, you learn how to:
Prerequisites
An Azure account and subscription. Get a free Azure account.
The logic app resource and workflow where you want to set up mock outputs. This article uses a Recurrence trigger and HTTP action as an example workflow.
If you're new to logic apps, create a workflow first:
Limitations
Mock outputs (static results) are available only for actions, not triggers.
No option currently exists to dynamically or programmatically enable and disable mock outputs.
No indications exist at the logic app level that mock outputs are enabled. Instead, look for these signs:
On the action shape, the lower-right corner shows the test beaker icon (
).On the action's details pane, on Testing tab, the Static Result option is enabled.
In code view, the action's JSON definition includes the following properties in the
runtimeConfigurationJSON object:"runtimeConfiguration": { "staticResult": { "name": "{action-name-ordinal}", "staticResultOptions": "Enabled" } }In the workflow's run history, the Static Results column appears with the word Enabled next to any run where at least one action has this capability enabled.
Set up mock outputs on an action
In the Azure portal, open your Consumption logic app workflow in the designer.
On the designer, select the action where you want to return mock outputs.
On the action information pane, select Testing, for example:
On the Testing tab, select Enable Static Result.
From the Select Fields list, select the properties where you want to specify mock outputs to return in the action's response.
The available properties differ based on the selected action type. For example, the HTTP action has the following sections and properties:
Section or property Required Description Status Yes The action status to return.
- If you select Succeeded, you must also select Outputs from the Select Fields list.
- If you select Failed, you must also select Error from the Select Fields list.Code No The specific code to return for the action Error Yes, when the Status is Failed The error message and an optional error code to return Output Yes, when the Status is Succeeded The status code, header content, and an optional body to return The following example shows when Status is set to Failed, which requires that you select the Error field and provide values for the Error Message and Error Code properties:
When you're ready, select Save.
The action's lower-right corner now shows a test beaker icon (
), which indicates that you enabled static results.To find workflow runs that use mock outputs, see Find runs that use static results later in this guide.
Find runs that use mock outputs (Consumption only)
To find earlier workflow runs where the actions use mock outputs, review that workflow's run history. This section applies only to Consumption workflows. For Standard workflows, see View workflow run history.
In the Azure portal, open your Consumption logic app workflow in the designer.
On your logic app resource menu, select Overview.
Under the Essentials section, select Runs history, if not selected.
In the Runs history table, find the Static Results column.
Any run that includes actions with mock outputs has the Static Results column set to Enabled, for example:
To view the actions in a run that uses mock outputs, select the run where the Static Results column is set to Enabled.
In the workflow run details pane, actions that use static results show the test beaker icon (
), for example:
Disable mock outputs
Turning off static results on an action doesn't remove the values from your last setup. If you turn on static results again on the same action, you can continue using your previous values.
In the Azure portal, open your logic app workflow in the designer.
Find and select the action where you want to disable mock outputs.
In the action details pane, select the Testing tab.
Select Disable Static Result > Save.
Reference
For more information about this setting in your underlying workflow definitions, see: