Automated Testing with Logic Apps and Specflow

Preview:

Citation preview

Automated Testing with Logic Apps and Specflow

Michael Stephensonhttps://www.linkedin.com/in/michaelstephensonuk1

Michael StephensonMVP

Testing Logic Apps

3

Michael Stephenson• Coaching & Consultancy

• Azure Trainer• Integration Architect

• Loads of real world Azure projects

• #IntegrationMonday

• Blog - http://microsoftintegration.guru/blog/

• Twitter - @michael_stephen

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

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

What does good look like?

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

What does Good Look Like?

Why is it a challenge?

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

Challenges

10

Sample Logic App

If Label = YES

Option 1 – Cloud Only

12

Example 1

If Label = YES

Run TriggerI cant see the File in the container

13

Example 2

1) Make HTTP request2) Did I get a good response

3) Does the data match in Salesforce

Postman

14

Good BadIts ok for trying stuff out and easy to test This is what bad BizTalk testing has looked

like for yearsIts not reliable/repeatableThere is no knowledge transfer to others about how solution worksWont work with automated buildNot great in team scenarios

Thoughts

Option 2 – Black Box Testing

16

Example 3

If Label = YES

1) Clean Queue

Automated Test

3) Pop message on queue 2) Clean Storage4) Did file appear

17

Good BadProvides 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

Thoughts

Option 3 – Whitebox Testing

19

Example 4

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 EventsDiagnostics – Event Hub

5) Is file in folder

6) Does file content match expected

20

Good BadProvides 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 significantlyTest what happens inside the logic appTests reliableTest the actions and triggers you expect have been executed

Thoughts

Questions

Recommended