Test your Azure Logic Apps

Dec 16, 2022 4:45 PM

Personal blog
Microsoft
Azure
Logic Apps
Testing

Getting started

You can simulate your workflows by using mock values instead of live apps, data, services, or systems, to test different action paths, force errors, provide specific message response bodies, or skip steps. Setting up mock data for an action allows you to test it without actually running the action, and instead returns the mock data you provided. For instance, if you set up mock data for the HTTP Request action in Azure Logic Apps, it will return the mock data instead of making request and get the actual data.

Let's have a look on how this done!

Enabling testing

Go to the Azure portal and navigate to your Logic App. Open the designer view by clicking on Edit or Logic app designer underneath the Development Tools category.

Your Logic App will require atleast one action that connects to a service or system such as an HTTP Request or making use of connector like SQL Server. Connectors such as Data Operations will not work.

Click on the 3 dots ... to view all options, and select Testing (preview).

Enable the Static review (preview) to configure your test with Mock data.

By default you are able to let a action succeed or fail, output a status code and specify headers. This allows you to test all kind of scenarios and see how other steps within your workflow respond. It is a nice way of doing some simple integration tests, but this is not all.

To actually provide the Mock data to do all these kinds of scenario testing, we need to enable some additional fields such as Code and Error, these fields allow for customisation of your testing and within the Code field, your Mock data can provided, while in the Error field a custom error message can be given.

To separate runs with tests from regular runs, they can be indentified by showing the Enabled status within the Static Results column within the run history of your Logic App.

I'm curious to see what else will become possible with this feature when it becomes General Available!

What's next?

Recently I have been working on backup solutions for the Azure Data Lake service, which might be a nice side step from Logic Apps and see what the current best practises are! See you next week.