Test workflows with mock outputs in Azure Logic Apps
Applies to: Azure Logic Apps (Consumption + Standard)
To test your workflow without affecting your production environments, you can set up and return mock outputs, or static results, from your workflow operations. That way, you don't have to call or access your live apps, data, services, or systems. For example, you might want to test different action paths based on various conditions, force errors, provide specific message response bodies, or even try skipping some steps. Setting up mock results from an action doesn't run the operation, but returns the test output instead.
For example, if you set up mock outputs for the Outlook 365 send mail action, Azure Logic Apps just returns the mock outputs that you provided, rather than call Outlook and send an email.
This guide shows how to set up mock outputs for an action in a Consumption or Standard logic app workflow.
Prerequisites
An Azure account and subscription. If you don't have a subscription, sign up for 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, see the following documentation:
Limitations
This capability is available only for actions, not triggers.
No option currently exists to dynamically or programmatically enable and disable this capability.
No indications exist at the logic app level that this capability is enabled. The following list describes where you can find indications that this capability is enabled:
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
runtimeConfiguration
JSON 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
To find earlier workflow runs where the actions use mock outputs, review that workflow's 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. So, 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 Static results - Schema reference for Workflow Definition Language and runtimeConfiguration.staticResult - Runtime configuration settings.
Next steps
- Learn more about Azure Logic Apps