Behavior Driven BizTalk Development Connected Systems Consulting Ltd
May 12, 2015
Behavior Driven BizTalk Development
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
– One of organizers of UK Connected Systems User Group
– Blog: www.geekswithblogs.net/michaelstephenson
– Twitter: @michael_Stephen
– Linked In: http://www.linkedin.com/in/michaelstephensonuk1
Connected Systems Consulting Ltd
Agenda• BDD 101• How can BDD help BizTalk projects• Simple Specflow Example• Detailed BizTalk Example• Limitations• Discussion
Connected Systems Consulting Ltd
Setting the scene• Small integration team with a number of BizTalk and other
integration projects or varying sizes and flavours
• Team already has fairly mature development processes
• Growth in new projects and team size and complexity of projects
• As a team we wanted to look at bringing in any new practices which we felt will help us be more effective
• How people use BDD in the .net world is something we have been looking at
Connected Systems Consulting Ltd
What is BDD• Behaviour Driven Development
• Agile software development technique
• Extends the idea of test driven development
• Create a clear understanding of the behaviour of the software
• Common language with the business
• Is not a replacement for unit testing
BDD 101
Connected Systems Consulting Ltd
Gherkins & Cucumbers• Cucumber
– A ruby tool that lets you specify a behaviour in terms of Given/When/Then
• The language/syntax is called Gherkin
• You define your behaviour in a “feature file” using the Gherkin language
• In .net world SpecFlow is a tool that lets us do the same thing (there are a couple of others)
Example BehaviourWhy is the feature important
What are we trying to do
Prerequisites
The trigger
What should happen
Who cares about the feature
Connected Systems Consulting Ltd
Key PointsKey Point Description
Business Value Identifying why a feature is needed helps determine if its important
Scenarios A feature can have multiple scenarios
Given/When/Then Gives us an easy way to describe what will happening a domain language the business will understand
Development We write code to implement the behaviour
HOW CAN BDD HELP BIZTALK PROJECTS?
Connected Systems Consulting Ltd
Common ChallengesArea Challenges
Requirements X - Its difficult to capture effective requirements in enough detail
X – Its difficult the manage and communicate change in requirements
X – Its difficult to ensure the requirements that are in a release of code
Documentation X – Documentation is often out of data
X – Documentation rarely matches what is deployed
X – Documentation is often big
Testing X – Tests are often too technical to easily correlate to requirements
X – Its difficult to prove the software does what its supposed to
An Example of current tests
• Tests are difficult to explain to non technical people
• Tests are difficult to understand if you don’t understand the business domain
• Its easy to read the implementation but difficult to understand the intention of parts of a test
Connected Systems Consulting Ltd
Initial thoughts
• Can Gherkin help us define what we need to do?
• Can the features describing behaviour become documentation?
• Can we use the behaviours to help test BizTalk?
Connected Systems Consulting Ltd
Introducing SpecFlow
• Specflow is a .net BDD framework
• Define features and scenarios in Visual Studio using the Gherkin language
• Features defined can become testable using SpecFlow
• Specflow tests are acceptance tests
Connected Systems Consulting Ltd
What about BizUnit?
• BizUnit is great at:– Execution of tests– Framework of test steps
• BizUnit struggles often at:– Helping you understand the intention of the test– Tests are too techy
• SpecFlow creates an abstraction between the intention and implementation of a test
Abstraction in the test
Gherkin
Test Definition
BizUnit
Test Implementation
Specflow
SIMPLE SPECFLOW EXAMPLE
DETAILED BIZTALK EXAMPLE
LIMITATIONS
Connected Systems Consulting Ltd
Challenges
• BizUnitOM is a little tricky & some test steps need to add implementation of ITestStepOM.
• SpecFlow after scenario cant be used to fire the test (use a final Then)
• At present some BizUnit steps cant be ran without being in a BizUnit test so we need to build up the BizUnit test then execute it
SUMMARY
Connected Systems Consulting Ltd
Common ChallengesArea Challenges
Requirements R - Requirements can be easily defined using Given/When/Then
R – Requirements are close to the code so easier to manage as features and scenarios
R – Requirements are defined in domain language
Documentation R - The feature files can be used as part of the documentation
R - The documentation is accurate to the build of code and can be published with a release
R - The scenarios are effective to document the scenarios and are not over excessive
R - The scenarios are maintained with the code
Testing R - There’s an abstraction between the intention and implementation of tests making them easier to understand
R - The requirements drive the testing
Connected Systems Consulting Ltd
Summary“We have a well established integration capability with a mature ALM process, however Behaviour Driven Development and SpecFlow is very interesting to us
because it offers ways to simplify some of our current pain points in the ALM process and make us more effective”
Would it help you?
More Info
Source/Article Link
SpecFlow http://www.specflow.org/
Testing example with CAT framework webcast
http://www.cloudcasts.net/ViewWebcast.aspx?webcastid=2521028145037920619
Questions?