0
votes

I created a Logic App that runs Azure Functions in a specific order. Depending on the outcome of some Azure Functions different "paths" of the workflow are chosen. This is mostly done by checking what StatusCode an AzureFunction returned.

I need to write automatic tests for the Logic App, however, the Azure Functions are not yet fully functional.

I am wondering how to approach this. I know that Logic Apps can't be run locally, so i will have to be creating a test instance on Azure every time the tests are run. I found out that Microsoft.Azure.Management.Logic allows management of Logic Apps. I'm able to create and delete Logic Apps in c# code, which will definitely help automating the tests. I'm still not sure if i can get information about a certain run. I am working on that.

My question is how to mock the Azure Functions. I figure those mocks will have to work differently than the actual Azure Functions, but i wouldn't want to have to actually deploy them to Azure. Can Logic Apps use locally deployed Azure Functions?

Is there a better way of testing just the workflow of the Logic App automatically? Maybe even without the need of deploying Azure Functions?

1
Put the function login in its own class so that it can be tested in isolation separate from Functions. Azure Functions should be seen as an implementation concern.Nkosi
Can you provide some code that demonstrates what it is you are referring to. That should help us better understand the actual problem so we can suggest solutions, if any.Nkosi

1 Answers

0
votes

As suggested by @Nkosi, you should write code that will enable you to test response from an Azure Function. For testing, Azure Function itself, you can generate mock requests to trigger functions. Please take a look at the sample here https://github.com/Azure-Samples/functions-unittesting-sample