automated testing for biztalk hl7 solutions
DESCRIPTION
This slide deck is about automated testing of BizTalk HL7 solutions and showing how you can use behaviour driven acceptance tests to automate your testingTRANSCRIPT
Automated Testing for BizTalk HL7 Accelerator
Connected Systems Consulting Ltd
Connected Systems Consulting Ltd
Who am I?Michael Stephenson
– UK-Based Freelance Consultant specializing in:• BizTalk• Windows Azure• Integration
– Was BizTalk MVP now a Microsoft Integration MVP for 5+ years– Pluralsight Author– One of organizers of UK Connected Systems User Group– Founder of BizTalk Maturity Assessment – www.biztalkmaturity.com
– Contact Info:• Blog: www.geekswithblogs.net/michaelstephenson• Twitter: @michael_Stephen• Linked In: http://www.linkedin.com/in/michaelstephensonuk1• Email: [email protected]
Connected Systems Consulting Ltd
Before we start• Projects are often poor at automated testing
• Projects often struggle to have applications to test against
• Projects struggle to stub out applications– Particularly HL7 applications
• HL7 projects with BizTalk are some of the most complex
Connected Systems Consulting Ltd
Agenda• Intro• Common Scenario• Typical Solutions• What do we want?• Usage Scenarios• Demo• Summary
INTRO
Connected Systems Consulting Ltd
Aim of today
• Improve your productivity!
• Improve the quality of the solutions you deliver!
• Lower the total cost of ownership of your BizTalk solution!
• Help you to automate testing of HL7 integration
COMMON SCENARIO
Example Interface
BizTalk
MLLP Adapter
Message Box
MLLP Adapter
Receive Pipeline Send Pipeline
HL7 Application HL7 Application
Orchestration
Typical Testing Environment
BizTalk
Application 6
Application 5
Application 4
Application 3
Application 2
Application 1
Sorry this application is being used by another team
Sorry this application is down for maintenance
This application isn’t very reliable in the test environment
This application is managed by a vendor and there is an SLA to
arrange to use it
Connected Systems Consulting Ltd
Typical Problems• Don’t have enough test environments• Each environment doesn’t have an instance of
each application• Environment usage conflict between projects or
teams• Test cases take a long time to run which creates
usage conflict• Applications in an environment aren’t always the
right versions• Applications are shared between environments• Need resources from other teams to help you
Dependency on the HL7 applications is the problem
Stub them out is the answer!
Connected Systems Consulting Ltd
Value of Stubs
DevelopmentEarly
Integration Testing
System TestingUser
Acceptance Testing
Pre-Production
Testing
Cost to find defect
Stub here to focus on getting BizTalk working
Stub here to do your developer and build tests
Stub here to deal with typical environment constraints
You shouldn’t need to stub here because BizTalk just works
But you can if you need to
Connected Systems Consulting Ltd
The Challenge
• Removing the dependencies can really help
• Stubbing out web services is easy, but how can we stub out the HL7 application?
TYPICAL SOLUTIONS
Use a different adapter
BizTalk
File Adapter
Message Box
File Adapter
Receive Pipeline Send Pipeline
Tester
Orchestration
Test Folder Test Folder
Checks message to see its valid
Thoughts
What’s good?• Orchestration tested• Not much else
What’s bad?• Port not tested• Adapter not tested• Tested solution not like
real solution• Low confidence
MLLP Utilities
BizTalk
MLLP Adapter
Message Box
MLLP Adapter
Receive Pipeline Send Pipeline
MLLPSend.exe MLLPReceive.exeOrchestration
TesterTrigger sending message
Start receiverCheck file
Thoughts
What’s good?• Tests the full BizTalk
solution• Can stub out HL7
applications with BizTalk MLLP Utility tools
• Other tools available to do similar– HL7 Edit
What’s bad?• Doesn’t scale easily to
many interfaces• Difficult to automate• If not automated takes
ages to run tests• Cant easily inspect
messages
WHAT DO WE WANT?
Connected Systems Consulting Ltd
Vision• Test interfaces with:
– Behaviour Driven Development– .net Unit Testing approaches
• Be able to automate the tests• Stub out all HL7 Applications• Able to scale to work with complex solutions• Easy to use• Able to use in developer tests and integration tests
Connected Systems Consulting Ltd
Introducing the solution
• AppFx.HL7.Testing.Utilities– Open source testing library– Aimed specifically at BizTalk Healthcare solutions (can be used
elsewhere thou)– Stub out HL7 Applications– Test your assumptions on how an HL7 application works
– Find it on • Codeplex – https://appfxhl7testing.codeplex.com/
Connected Systems Consulting Ltd
Features
• Transport– Send messages over MLLP– Receive messages over MLLP
• Application Stubbing– Stub many applications by adding configuration– Handle messages for different test scenarios
• HL7 Messages– Helpers to parse messages– Patterns to make messages easier to compare
• Testing– Can be used by .net Testing– Can be used by Specflow BDD testing
USAGE SCENARIOS
Validate Application Assumptions
HL7 ApplicationHL7 Test Framework
BDD Test
Send message
Receive Acknowledgement
Validate Acknowledgement
Send response
Validate Response
We know how the HL7 application works before we connect BizTalk to it
Automated BizTalk Testing
BizTalk
MLLP Adapter
Message Box
MLLP Adapter
Receive Pipeline Send Pipeline
Orchestration
BDD Test
HL7 Test Framework
Validate Message
We can stub out the HL7 applications
This allows us to test BizTalk in isolation
DEMO
Connected Systems Consulting Ltd
Demo Challenge
• Lets take one of the HL7 accelerator samples and write BDD style specifications and tests for it!
Demo Scenario
Interrogative Tutorial in BizTalk HL7 accelerator samples
Demo Walk-thru
BizTalk
Message Box
ADT Receive HIS Send
BDD Test
HL7 Test Framework
Validate Message
ADT Send HIS Receive
Send Message
Send ACK
Send Message to HIS
Send Response
Send Response to ADT
Sample Domain
Demo Infrastructure
Domain Controller BizTalk 2009+
SQL Server 2008
Tester Machine
BizTalk HL7 Sample Deployed here
BDD Tests developed and ran from here
BizTalk send ports point to test machine
DEMO
SUMMARY
Thoughts
What’s good?• Tests the full solution• Quite simple to use• Can stub out many HL7 applications
concurrently• Can have different message handlers
for different test cases• Fits into .net testing frameworks• Validation of messages• Reusability within test
implementation• Promotes the benefits of BDD/TDD• Use in different types of testing
– Developer unit testing– Automated system testing
• Works with multiple versions of BizTalk
What’s Next?• Looking for community feedback• Does it work for your scenarios• Are there any missing features
More Info
Source/Article Link
SpecFlow http://www.specflow.org/
Testing example with CAT framework webcast
http://tinyurl.com/test-insidebiztalk
Questions?