At Integration Monday, we have had feedback from the audience that people are struggling with understanding how to do automated testing with Logic Apps. Back in the day Mike Stephenson wrote a lot of guidance about automated testing & unit testing for BizTalk. So he took up the challenge of trying to help out on this one.
In this session, we will discus some of the challenges around testing Logic Apps and then we will work through some examples of how testing can be performed and finally we will look at an approach which should put us in a solid place to be able to test Logic Apps both as an individual developer and via an automated build.
3. Michael Stephenson
• Coaching & Consultancy
• Azure Trainer
• Integration Architect
• Loads of real world Azure projects
• #IntegrationMonday
• Blog - http://microsoftintegration.guru/blog/
• Twitter - @michael_stephen
3
4. Agenda
• Agenda
• Why is this a challenge?
• What does good look like?
• Why Specflow?
• Option 1 – Cloud Only
• Option 2 – VS Black Box
Testing
• Option 3 – VS Whitebox Testing
• Other Challenges
• Outcomes
• Awareness of different ways to
test Logic Apps
• Practical examples
5. Meet the Dev Team
5
Dave – The lazy developer
Everyone hates supporting Dave’s code
Bob – Wants to deliver quality
solutions but isn’t really sure how to do it
Bob also likes funky hats and has fashion issues
Steve – Has loads of automated testing
experience, always looking to improve quality.
Steve works out but rarely does Leg Day
7. • Developer runs tests on their own machine before checking in
changes
• On check in an automated build creates a clean environment
and build/deploy/run tests in a sandbox
• After build we have a reliable version of code which is well
tested and we have confidence in
• The version can be deployed to other environments easily
• The tests are self describing and tests the software does what
its expected to do
• The tests are ran each time a change is committed
7
What does Good Look Like?
9. • Stubbing
• BizTalk had separation between Transport and Logic
• Logic Apps does not
• Makes it hard to test logic without dependencies on transport
• Fear/Lack of experience of Cloud
• Many of the integration scenarios are new
• Learning curve is steep
• Automated testing is one more complexity
• Logic App Maturity
• Changing product
• Hard to settle on approaches for ALM while lots of change
9
Challenges
13. Example 2
13
1) Make HTTP request
2) Did I get a good response
3) Does the data match
in Salesforce
Postman
14. Good Bad
Its ok for trying stuff out and easy to test This is what bad BizTalk testing has looked like
for years
Its not reliable/repeatable
There is no knowledge transfer to others about
how solution works
Wont work with automated build
Not great in team scenarios
14
Thoughts
16. Example 3
16
If Label = YES
1) Clean Queue
Automated Test
3) Pop message on queue 2) Clean Storage4) Did file appear
17. Good Bad
Provides some knowledge of how its supposed to
work
Did the logic app execute the way we expected it
to?
How do we know if it took the wrong branch?
Repeatable test Tests are often brittle as lots of waiting for
something to happen
Risk is reduced Some scenarios might be difficult depending upon
the dependancies
You can probably automate most scenarios
17
Thoughts
19. Example 4
19
If Label = YES
1) Clean Queue
Automated Test
3) Pop message on queue 2) Clean Storage
4) Make assertions about the workflow
events
- Eg did action execute
Workflow Execution Events
Diagnostics – Event Hub
5) Is file in folder
6) Does file content match expected
20. Good Bad
Provides extensive detail on how solution works Diagnostics events sometimes slowish so tests
aren’t that quick
Repeatable test Diagnostics events sometimes include old events,
my helper class gets rid of those
Risk is reduced significantly
Test what happens inside the logic app
Tests reliable
Test the actions and triggers you expect have
been executed
20
Thoughts