Testing for Logic App
Solutions
Michael Stephenson
About Me
• Work
• FreelanceCloud& IntegrationConsultant
• Realworldprojectsw/Azurefor10+years
• Community
• MicrosoftMVP = 12years
• Twitter = @michael_stephen
https://www.integration-playbook.io/
-
-
http://www.integrationusergroup.com/
Agenda
• Real-world Project
• History of Logic App Testing
• Hello World
• Real-world Developer Example
• Integration Account Testing
• Logic App Unit Testing
• System Testing
• Manual
• Automated
• Common Real-world Challenges
The Project
• Big Energy Company
• Azure Integration Platform
• Many concurrent projects running
• Many interfaces in Production
• Many interfaces in development
• 2000+ Azure resources
• Many Azure DevOps pipelines
• Logic Apps
• Functions
• Terraform
• APIM Service Bus
• etc
• Many Automated Tests
History
Apr. 2017
Integration Monday Session where took a look at how you might do
Integration Testing
http://www.integrationusergroup.com/automated-testing-logic-apps-
specflow/
Nov. 2017
Shankar Chandrasekar created Logic App Unit Test Manager on
GitHub/NuGet
https://github.com/shankarmaha/LogicAppUnitTestManager
2019
Kent Weare talked about using Mock Data feature in Logic Apps to help
https://www.serverless360.com/blog/testing-azure-logic-apps-with-
mock-data
Demo 1 - Basic Specflow + Logic App
• Specflow for human readable test intention
• C# & MsTest (or whatever fx you like) for test
implementation
• Trigger your Logic App
• Make assertions about the actions that have
ran
Azure
My Logic App
My Visual Studio Project
Trigger Assert
Real-World Example
Azure Integration Account
SFTP Server
Source System
Service Bus
Receiver
Processing Logic
Look up user data Create File
Demo 2 – Unit Testing Components
What
• Flat File Encode
• Flat File Decode
• XML Transform
How
Azure
Integration Account
My Visual Studio Project
Map Helper Flat File
Decode
Helper
Flat File
Encode
Helper
Demo 3 - Complex Logic App Unit Testing
What
• Specflow to describe behavior
• .net to implement test
How
Azure
My Logic App
My Visual Studio Project
Trigger Assert
Integration Account
SFTP Server
Demo 4 – Using Power Platform
& BAM for Manual Testing
Azure Integration Account
SFTP Server
Source System
Service Bus
Receiver
Processing Logic
Look up user data Create File
BAM Events
Assert
PrepareTrigger
Assert
Demo 5 – Automating the System Test
Can I automate some of the previous Test?
How can I handle the challenge of not knowing which Logic App run
is for my test?
Demo 5 – Automating the
System Test
Azure
Integration Account
SFTP Server
Source System
Service Bus
Receiver
Processing Logic
Look up user data Create File
BAM Events
Assert
Trigger
Assert
My Visual Studio Project
Real world Challenges
Static Result
+ Positives - Negatives
• You cant really support multiple responses for
an action
• It’s a bit fiddly to turn on/off static result
• Hard to change between which action is static
and which isnt
• Good for simple scenarios
• Supports many connectors
• Great for LOB connectors
• Good for working on interfaces which are “In
Progress”
Verdict: Good for POC but we don’t really use it
Stub API
+ Positives - Negatives
• Not easy to use for non HTTP based
connectors
• More components to maintain
• 3rd Party Solutions (eg Mockaroo)
• Build Custom (logic app/functions/APIM)
• Quite easy to do
• Helps with complex scenarios
Verdict: We use this quite a bit but in the right places
Helper Logic Apps Patterns
+ Positives - Negatives
• Performance trade off• Lowers overall maintenance and less code
• Rely on a tested reusable unit
• Simplify your logic apps  make easier to
test
• Can “swap” logic app call at deployment time
Verdict: We use this quite a bit
Data Services
Business Interfaces
Routers & Routing Slip Pattern
+ Positives - Negatives
• Performance trade off so use in the right
place
• Need to test the routing rules
• Helps to break your Logic Apps down into
composable  Easier to test
• More flexibility
Verdict: Good when used in the right place Article by Toon:
https://www.codit.eu/blog/the-routing-slip-pattern/?country_sel=uk
Logic App Testing Summary
Now
• Capability
• Approach is solid
• Maintenance overhead is minimal
• Benefits
• Lowers risk
• Fewer defects
• Self documenting
• Gaps
• There are some
• There are trade offs for coupling of
connectors to logic
Next
• How will this work with Logic Apps
on Functions Runtime?
• Run locally on function host?
• Will the management api change?
• How will integration accounts work?
Future Sessions
We have done some Terraform Would anyone like to see
More Terraform (APIM, Service Bus, etc)
Logic Apps + DevOps
Functions + DevOps
Testing Integrated with DevOps
Other?
Questions

Testing for Logic App Solutions | Integration Monday

  • 1.
    Testing for LogicApp Solutions Michael Stephenson
  • 2.
    About Me • Work •FreelanceCloud& IntegrationConsultant • Realworldprojectsw/Azurefor10+years • Community • MicrosoftMVP = 12years • Twitter = @michael_stephen https://www.integration-playbook.io/ - - http://www.integrationusergroup.com/
  • 3.
    Agenda • Real-world Project •History of Logic App Testing • Hello World • Real-world Developer Example • Integration Account Testing • Logic App Unit Testing • System Testing • Manual • Automated • Common Real-world Challenges
  • 4.
    The Project • BigEnergy Company • Azure Integration Platform • Many concurrent projects running • Many interfaces in Production • Many interfaces in development • 2000+ Azure resources • Many Azure DevOps pipelines • Logic Apps • Functions • Terraform • APIM Service Bus • etc • Many Automated Tests
  • 5.
    History Apr. 2017 Integration MondaySession where took a look at how you might do Integration Testing http://www.integrationusergroup.com/automated-testing-logic-apps- specflow/ Nov. 2017 Shankar Chandrasekar created Logic App Unit Test Manager on GitHub/NuGet https://github.com/shankarmaha/LogicAppUnitTestManager 2019 Kent Weare talked about using Mock Data feature in Logic Apps to help https://www.serverless360.com/blog/testing-azure-logic-apps-with- mock-data
  • 6.
    Demo 1 -Basic Specflow + Logic App • Specflow for human readable test intention • C# & MsTest (or whatever fx you like) for test implementation • Trigger your Logic App • Make assertions about the actions that have ran Azure My Logic App My Visual Studio Project Trigger Assert
  • 7.
    Real-World Example Azure IntegrationAccount SFTP Server Source System Service Bus Receiver Processing Logic Look up user data Create File
  • 8.
    Demo 2 –Unit Testing Components What • Flat File Encode • Flat File Decode • XML Transform How Azure Integration Account My Visual Studio Project Map Helper Flat File Decode Helper Flat File Encode Helper
  • 9.
    Demo 3 -Complex Logic App Unit Testing What • Specflow to describe behavior • .net to implement test How Azure My Logic App My Visual Studio Project Trigger Assert Integration Account SFTP Server
  • 10.
    Demo 4 –Using Power Platform & BAM for Manual Testing Azure Integration Account SFTP Server Source System Service Bus Receiver Processing Logic Look up user data Create File BAM Events Assert PrepareTrigger Assert
  • 11.
    Demo 5 –Automating the System Test Can I automate some of the previous Test? How can I handle the challenge of not knowing which Logic App run is for my test?
  • 12.
    Demo 5 –Automating the System Test Azure Integration Account SFTP Server Source System Service Bus Receiver Processing Logic Look up user data Create File BAM Events Assert Trigger Assert My Visual Studio Project
  • 13.
  • 14.
    Static Result + Positives- Negatives • You cant really support multiple responses for an action • It’s a bit fiddly to turn on/off static result • Hard to change between which action is static and which isnt • Good for simple scenarios • Supports many connectors • Great for LOB connectors • Good for working on interfaces which are “In Progress” Verdict: Good for POC but we don’t really use it
  • 15.
    Stub API + Positives- Negatives • Not easy to use for non HTTP based connectors • More components to maintain • 3rd Party Solutions (eg Mockaroo) • Build Custom (logic app/functions/APIM) • Quite easy to do • Helps with complex scenarios Verdict: We use this quite a bit but in the right places
  • 16.
    Helper Logic AppsPatterns + Positives - Negatives • Performance trade off• Lowers overall maintenance and less code • Rely on a tested reusable unit • Simplify your logic apps  make easier to test • Can “swap” logic app call at deployment time Verdict: We use this quite a bit Data Services Business Interfaces
  • 17.
    Routers & RoutingSlip Pattern + Positives - Negatives • Performance trade off so use in the right place • Need to test the routing rules • Helps to break your Logic Apps down into composable  Easier to test • More flexibility Verdict: Good when used in the right place Article by Toon: https://www.codit.eu/blog/the-routing-slip-pattern/?country_sel=uk
  • 18.
    Logic App TestingSummary Now • Capability • Approach is solid • Maintenance overhead is minimal • Benefits • Lowers risk • Fewer defects • Self documenting • Gaps • There are some • There are trade offs for coupling of connectors to logic Next • How will this work with Logic Apps on Functions Runtime? • Run locally on function host? • Will the management api change? • How will integration accounts work?
  • 19.
    Future Sessions We havedone some Terraform Would anyone like to see More Terraform (APIM, Service Bus, etc) Logic Apps + DevOps Functions + DevOps Testing Integrated with DevOps Other?
  • 20.