Geeks With Blogs

News View Michael Stephenson's profile on BizTalk Blog Doc View Michael Stephenson's profile on LinkedIn
Michael Stephenson keeping your feet on premise while your heads in the cloud

BizUnit is a unit testing framework for BizTalk.  This post will demonstrate how to test any schema you create using BizUnit to help you do this.


So the problem is that you have a schema which may change over time and you want to ensure it will always validate messages as you expect.  In BizTalk you have a context menu which allows you to validate this schema and also validate instances of messages against the schema.  The problem however is you want to do this as part of your unit tests so you want to automate this.


There are a number of ways this could be solved for example writing some C# to validate the schema but the new BizUnit framework allows us to simplify this task.  The following example demonstrates using BizUnit to test a schema.

1.  Solution Structure

In the following diagram you can see the solution structure being used in this diagram:

The key points to note are:

  • There is a project called Acme.Integration.Sample.Schemas which contains a simple schema for a customer details request message.
  • There is a project called Acme.Integration.Sample.Schemas.Tests which contains the stuff for testing the schemas project.

2. Acme.Integration.Sample.Schemas

This is a simple project containing 1 simple schema.

3. Acme.Integration.Sample.Schemas.Tests

This project contains 2 folders which are used to hold the test case and test data files used by BizUnit.  There is also a C# class which calls BizUnit to execute each test.  The following diagram shows some example tests used on this schema.  As you can see the tests are just like normal VSTS or NUnit tests with the exception that they call BizUnit to have it execute some steps for that individual test.

The test case executed by BizUnit are defined in an xml file.  The below diagram shows the file used for one of the tests against this schema.  As you can see we use the BizUnit FileExists step to validate the file we want to use (aka the test data file) is in the test directory (Note: I use the test run config file to copy all of the test cases and test data files to the testing directory).  Within the file exists step we also execute am XmlValidation step which points to our schema and runs the file against that

To create the test data file it is easiest to use the Generate Instance menu item on the schemas context menu to generate a valid document, and then edit this to suit your test case.

Note: This project should reference Microsoft.Services.BizTalkApplicationFramework.BizUnit

4. Running the Tests

The tests can be run just as normal VSTS & NUnit tests

Posted on Sunday, September 17, 2006 11:42 AM BizTalk | Back to top

Comments on this post: Testing Schema with BizUnit

# re: Testing Schema with BizUnit
Requesting Gravatar...
Amazing post thanks for sharing with all of us and we all are very thankful after seeing this post
Feliz Navidad 2016
Feliz Año Nuevo 2017 UKRFUYTFDCUY
Left by DIPIKA on Dec 16, 2016 9:40 PM

# re: Testing Schema with BizUnit
Requesting Gravatar...
Left by zapya boogy on Mar 30, 2017 1:18 AM

# re: Testing Schema with BizUnit
Requesting Gravatar...
Left by mobdro tv app for pc on May 12, 2017 6:19 PM

# watergadget
Requesting Gravatar...
market for your home, multiply the number of adequate one that you would have the ability to
Left by stain on Sep 12, 2017 11:54 PM

# re: Testing Schema with BizUnit
Requesting Gravatar...
We have something amazing for you that you must check

Romantic DP for Whatsapp

Also see

Telegram Group links

Don't miss

WA Tweaks APK
Left by Techmatric on Sep 21, 2017 9:12 PM

# snapchatapkdownload
Requesting Gravatar...
yet we recommend using the main Snapchat Login for security. snapchatapkdownload over the full step-by-step procedure for getting the app.
Left by Haley on Nov 22, 2017 11:17 PM

# instagram for pc
Requesting Gravatar...
Left by Raina Ram on Jan 01, 2018 8:24 PM

# whatsuply
Requesting Gravatar...
Android emulator aids to run any kind of android application on your pc system, whatsuply the WhatsApp for PC variation assists you to message.
Left by tom on Jan 09, 2018 4:32 PM

Your comment:
 (will show your gravatar)

Copyright © Michael Stephenson | Powered by: