Share What We Say

Filter by:


Automated testing of Azure Biztalk Services maps

Leandro Blog - Sat, 2016-03-05 00:48

Azure BizTalk Services (also known as WABS: Windows Azure Biztalk Services and MABS: Microsoft Azure Biztalk Services) enables Biztalk-like services that run on the cloud.

Like BizTalk Server, Azure BizTalk Services include a mapping/transform services is included. This service can be invoked to perform XML mapping in Azure Logic Apps.

Unlike regular BizTalk, there’s nothing included in the SDK to perform automated map testing.

After playing around with Reflection and the Visual Studio Extension assemblies included in the Biztalk Services SDK, we are now able to programatically test Biztalk Services maps (maps with trfm extension).

I created a simple helper class that can be used to test the map.

All you need to do is call the static MapTester.TestMap method with the map file path and the input file path. Here’s a sample test call:

using System; using Microsoft.VisualStudio.TestTools.UnitTesting; using BizTalkServicesTesting.Helpers; using System.IO; namespace BizTalkServicesTesting.Tests { [TestClass] public class MapUnitTests { [TestMethod] public void SampleMapTest() { var mapFilePath = @"..\..\..\BiztalkServicesTesting.Artifacts\Map.trfm"; var inputFilePath = @"SampleInput.xml"; var testMapResult = MapTester.TestMap(mapFilePath, inputFilePath); Assert.AreEqual(true, testMapResult.Success); Assert.AreEqual( @"<?xml version=""1.0"" encoding=""utf-8""?> <ns1:Root xmlns:ns0="""" xmlns:ns1=""""> <ns1:Target1>Source1_0</ns1:Target1> <ns1:Target2>Source2_0</ns1:Target2> </ns1:Root>", testMapResult.OutputText); } } }

In order to be able to use this library, we need to reference several Azure BizTalk Services SDK assemblies. To avoid licensing issues I haven’t provided included them in the post, you can download the SDK from here:

These are the libraries you need to add them to the Lib folder in the downloaded source code, or add as references in your unit test projects if you download the compiled version. Once the SDK is installed, they can be found in the following path “C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Windows Azure BizTalk Services SDK”.

  • Microsoft.ApplicationServer.Integration.Common.Core.dll
  • Microsoft.ApplicationServer.Integration.Common.dll
  • Microsoft.ApplicationServer.Integration.Pipeline.dll
  • Microsoft.ApplicationServer.Integration.Services.Pipeline.Tracing.dll
  • Microsoft.ApplicationServer.Integration.Transforms.BaseFunctoids.dll
  • Microsoft.ApplicationServer.Integration.Transforms.Common.dll
  • Microsoft.ApplicationServer.Integration.Transforms.Compiler.Common.dll
  • Microsoft.ApplicationServer.Integration.Transforms.Compiler.XamlGenerator.dll
  • Microsoft.ApplicationServer.Integration.Transforms.MapCompiler.dll
  • Microsoft.ApplicationServer.Integration.Transforms.MapOM.dll
  • Microsoft.ApplicationServer.Integration.Transforms.Mapper.OM.dll
  • Microsoft.ApplicationServer.Integration.Transforms.Runtime.BuiltInFunctions.dll
  • Microsoft.ApplicationServer.Integration.Transforms.Runtime.dll
  • Microsoft.ApplicationServer.Integration.Transforms.TOM.dll

This is how it works:

// Create output temp file name var outputFilePath = Path.GetTempFileName(); // Get MapCompiler type and methods var mapCompilerType = Type.GetType("Microsoft.ApplicationServer.Integration.Transforms.MapCompiler.MapCompiler, Microsoft.ApplicationServer.Integration.Transforms.MapCompiler"); var mapCompilerTestMapMethod = mapCompilerType.GetMethod("TestMap"); // Get TestMapConfiguration type and create instance var testMapConfigurationType = Type.GetType("Microsoft.ApplicationServer.Integration.Transforms.MapCompiler.TestMapConfiguration, Microsoft.ApplicationServer.Integration.Transforms.MapCompiler"); var testMapConfigurationInstance = testMapConfigurationType.GetConstructor(new Type[] { typeof(Dictionary<String, Object>) }).Invoke(new object[] { new Dictionary<String, Object>() }); // Get TestMapResult type and properties var testMapResultType = Type.GetType("Microsoft.ApplicationServer.Integration.Transforms.MapCompiler.TestMapResult, Microsoft.ApplicationServer.Integration.Transforms.MapCompiler"); var testMapResultOutputFileWrittenProperty = testMapResultType.GetProperty("OutputFileWritten"); var testMapResultErrorsProperty = testMapResultType.GetProperty("Errors"); var testMapResultWarningsProperty = testMapResultType.GetProperty("Warnings"); // Get MapError type and properties var mapErrorType = Type.GetType("Microsoft.ApplicationServer.Integration.Transforms.Common.MapError, Microsoft.ApplicationServer.Integration.Transforms.Common"); var mapErrorErrorMessageProperty = mapErrorType.GetProperty("ErrorMessage"); // Invoke MapCompiler TestMap method dynamic testMapResult = mapCompilerTestMapMethod.Invoke(null, new object[] { mapFilePath, inputFilePath, outputFilePath, testMapConfigurationInstance }); // Process TestMap results var result = new ExecutionResult(); result.Errors = ((IEnumerable<dynamic>)testMapResultErrorsProperty.GetValue(testMapResult)).Select(e => mapErrorErrorMessageProperty.GetValue(e)).Cast<string>().ToArray(); result.Warnings = ((IEnumerable<dynamic>)testMapResultWarningsProperty.GetValue(testMapResult)).Select(e => mapErrorErrorMessageProperty.GetValue(e)).Cast<string>().ToArray(); var outputMessageWritten = (bool)testMapResultOutputFileWrittenProperty.GetValue(testMapResult); if (outputMessageWritten) { result.OutputText = File.ReadAllText(outputFilePath); if (result.Errors.Length == 0) result.Success = true; }

BizTalk Services Testing Source Code (0)
BizTalk Services Testing Binaries (0)

Categories: Blogs

Computers Insecurity. Thinking like Hacker talk at UTN: The video (Spanish)

Leandro Boffi - Sat, 2015-06-27 20:10

Last June 13 I was invited by the Argentine National Technological University (UTN) in Buenos Aires to speak about computers security.

On my talk I provided a theoretical framework to think systems security but from a Hackers perspective with real life examples. It was really fun and such an honour so I am very grateful to have been invited.

I want to share with you the video of the talk, hoping you remember your spanish lessons!

Categories: Blogs

Speaking at UTN: Computers Insecurity. Thinking like a Hacker.

Leandro Boffi - Thu, 2015-06-11 02:25

Next Saturday 13 I will be speaking once again about Computers Security at Argentine National Technological University in Buenos Aires.


The National Technological University (Spanish: Universidad Tecnológica Nacional, UTN) is a country-wide national university in Argentina, and it’s considered among the top engineering schools in the country, so It is a great honour to be invited to speak there.

I will give an introduction to Computers Security, from a Hacker perspective, we will look at some basic security principles visiting real life examples of how they were broken and I will also talk about Hackers philosophy.

As part of the conference, named Libre Conference, other very interesting talks will take place about topics like Micro-services Architecture, NoSQL, Linux and WordPress

If you are on Buenos Aires at that time I hope to see you there! Sign-up here!

Categories: Blogs

Don't Inject Markup in A Web Page using Document.Write

Professional ASP.NET Blog - Tue, 2013-06-04 15:33
Look around just about every consumer facing site you visit these days has a third party script reference. Just about everyone uses Google Analytics and if you are like a former client of mine you have it and 2 other traffic analysis service scripts injected...(read more)
Categories: Blogs

Sending a Photo via SMS on Windows Phone

Professional ASP.NET Blog - Thu, 2013-05-30 03:01
Smartphones are awesome. They are the modern Swiss Army Knife because they do so much. One of the most important features in my opinion is taking photos. My Nokia Lumia has one of the best cameras available in a Smartphone and I like to use it all the...(read more)
Categories: Blogs

You Don't Need Windows To Test Your Web Site in Internet Explorer

Professional ASP.NET Blog - Wed, 2013-05-29 17:25
I know the majority of developers reading my Blogs are typically ASP.NET, enterprise developers. This means they develop on a Windows machine using Visual Studio most of the time. However in the broad market most modern web developers work on a MAC or...(read more)
Categories: Blogs

Using The New Git Support in WebMatrix 3

Professional ASP.NET Blog - Sun, 2013-05-26 15:19
WebMatrix is probably my favorite web development IDE because it is so simple and easy to use. Sure I use Visual Studio 2012 everyday and it has probably the best web development features available on the market. I also really dig Sublime. WebMatrix is...(read more)
Categories: Blogs

Publish to Directly To Azure Web Sites With WebMatrix

Professional ASP.NET Blog - Wed, 2013-05-01 20:39
WebMatrix is one of my favorite development tools because it really allows me to focus on what I love to do most, build modern web clients. It is a free Web IDE available from Microsoft and today they released version 3 for general availability . There...(read more)
Categories: Blogs

17000 Tweets in 365 Days - Not Too Many To Be Annoying

Professional ASP.NET Blog - Tue, 2013-04-30 14:29
What the heck was I thinking? Why did I do it? What did I learn? How did I do it? These are all things I have asked myself and others have asked me over the past year. It sounds like an odd labor to undertake and such an odd number. But yes I did 17,000...(read more)
Categories: Blogs

Introducing ToolbarJS - A HTML5 JavaScript Library to Implement the Windows Phone AppBar Functionality

Professional ASP.NET Blog - Sun, 2013-04-28 12:03
Back in February I released deeptissuejs , a HTML5, JavaScript touch gesture library. In January I release panoramajs a HTML5, JavaScript library to implement the basic Windows Phone panorama control experience. This month I am excited to release another...(read more)
Categories: Blogs

HTML5 and CSS3 Zebra Striping - Look Ma No JavaScript

Professional ASP.NET Blog - Mon, 2013-04-22 11:36
It was 5 maybe 6 years ago when I first started learning jQuery. One of the first things I did was order the jQuery In Action book . If you have read that book you should remember one of the first examples given, zebra striping a table. To me this example...(read more)
Categories: Blogs

Listen to Me Talk to Carl & Richard about the Surface Pro, Mobile Development and More

Professional ASP.NET Blog - Thu, 2013-04-18 11:53
A few weeks ago I got to sit down and chat with the DotNetRocks guys about a variety of topics. The initial premise for the interview was to talk about the Surface and why I love it so much. I think we got into some great tangents right from the start!...(read more)
Categories: Blogs

Why Its Time to Sunset jQuery

Professional ASP.NET Blog - Sun, 2013-04-14 14:15
I owe so much to John Resig and the jQuery team for creating such a wonderful framework. I have staked most of my recent career on jQuery the way I staked my career on ASP.NET back in 2001. I have built many applications using jQuery over the past five...(read more)
Categories: Blogs

The Good and Bad For - Helping it Scale With Web Performance Optimization

Professional ASP.NET Blog - Fri, 2013-04-12 13:30
BitCoin seems to be latest rage with wild value fluctuations. The past few days have seen a very wild roller coaster for the online currency. Most of the world's BitCoins are exchanged at , which has had some issues either with a denial of service...(read more)
Categories: Blogs

HTML5 Is Ready For the Big Time, Are You?

Professional ASP.NET Blog - Sun, 2013-04-07 02:11
Much has been said and 'debated' in recent years about the viability of HTML5. It should be obvious where I stand if you read my Blog or talk to me in person. HTML5, CSS3 and JavaScript are certainly ready and have been for a while. The big problem, as...(read more)
Categories: Blogs

Use a DataList element for an HTML5 Auto Complete Experience

Professional ASP.NET Blog - Mon, 2013-03-25 17:11
Guided user input is almost always a good idea when architecting a data entry experience. You want to help the user avoid potential mistakes. With on screen, mobile keyboards you want to reduce the keystrokes required to enter data and at the same time...(read more)
Categories: Blogs

Why I Think Microsoft Should Buy Barnes & Noble

Professional ASP.NET Blog - Tue, 2013-03-05 17:54
One of the topics discussed recently on Windows Weekly was Barnes and Noble's financial issues . During the discussion Mary Jo Foley mentioned the idea of Microsoft buying the retail chain. She mentioned it would give them, a sizable retail presence....(read more)
Categories: Blogs

More Than A Week With The Surface Pro - Very Happy

Professional ASP.NET Blog - Mon, 2013-02-25 21:02
Valentine's morning I gave myself a gift I had been wanting for quite some time, a 128GB Surface Pro . Acquiring my Surface may have been the most cumbersome task I have ever done to purchase a product, and I got a dozen Furby's when they were...(read more)
Categories: Blogs

Deeptissue.js A Gesture Library For the Modern Web

Professional ASP.NET Blog - Tue, 2013-02-19 16:13
Today I am announcing Deeptissue.js , a library to make life easier for developers in the modern world. The inspiration for this library is rooted in my selfish need to have something that would bridge the gap between the WebKit Touch API , Internet Explorer's...(read more)
Categories: Blogs

A Subtle CSS Rotation to Delight Users

Professional ASP.NET Blog - Wed, 2013-02-13 17:37
By now you should know that I am constantly on the lookout for cool and bad features implemented by web sites all the time. Last week I was reading some posts on Christian Hielman's blog . As I passed my mouse over the navigation on the right I noticed...(read more)
Categories: Blogs