3
votes

I have created a simple azure logic app.

  • Step 1 - http request
  • Step 2 - XML transformation
  • Having map file xslt added for XML file
  • Step 3- send transformation XML data into service bus queue.
  • Step 4 - request response

I want to create above logic app unit test cases using msunit project. I'm new to logic apps.

1
Do you want to test it without deploy on Azure?felixmondelo

1 Answers

6
votes

I've dug quite a bit into the topic when was looking closely into Logic Apps... AFAIK, whether with or without deploying your Logic App to Azure, there's no way unit test a specific step, sorry.

At the very best you could have an end-to-end / integration test. That would require you to deploy the App into Azure cloud, because you don't have any other way to make your Logic App's JSON definition executable locally (on your desktop, or other on-premise machine).

Now we're talking about end-to-end tests, hence there's a question how do you make sure that your test does not mess up production data, right? This, in turn, raises one of two subsequent questions:

  • How do I model environments/stages for Azure Logic Apps? or
  • How do I write my tests to guarantee that prod data is intact and no garbage data is generated in production either?

(Hint: Even though, both problems are solvable, none of these ^ questions have simple-easy answers. I personally decided to NOT go that way at all).


To give you some hope. In case you are okay with diverging from pure Logic App based solution, I'd recommend into implementing your custom logic as Azure Functions. Those functions are just normal JavaScript/C#/language of choice code which you actually can unit-test locally. Those functions are also easy to invoke from a Logic App.

The Logic App as a platform may work well as an orchestrating platform. It supports multiple triggers; allows controlling the degree of parallelism in your application; it lets you configure retry and timeout logic; and so on. It's just not good at all when it comes to everything that's related to expressing application logic that deals with the connectors.


Related sources: