Automated Deployment and Testing of BizTalk Server 2010 Applications

by Nick Hauenstein 8. December 2010 13:09

Back when BizTalk Server 2009 was released, there was a lot of buzz about the new integrated support for unit testing of schemas, maps, and pipelines, and cleaner support for automated builds driven by Team Foundation Server (TFS). These were definitely welcome additions that made it much easier to enable continuous integration with automated build and testing. However, there were some things missing. In this article, I’ll review the current state of automated build and testing capabilities that exists for BizTalk Server 2010 when using Visual Studio 2010 Team Foundation Server (TFS). I will first examine the items lacking out of the box, and then direct you to community projects that can improve the situation.

When it comes to the built-in unit testing support in BizTalk Server 2009 and 2010, there are still some areas lacking. For example, testing schemas with imports yielded erroneous results, as all of the necessary schemas were not used in validation. Testing pipelines cannot be accomplished purely in memory with the API exposed. There was not really any work done to enable integration and functional testing of orchestrations. Finally, the automated build process did not take into account the necessity for the bits that were compiled to be deployed somewhere for testing -- possibly due to the lack of functional and integration testing support for orchestrations (i.e., there would be no reason to deploy bits that could not be tested anyway).

Thankfully, community efforts filled in most of these gaps for BizTalk Server 2009, and indeed in most cases these community projects preceded the implementation of automated build and testing support in BizTalk Server. Pipeline, pipeline component, and flat-file schema testing was made much more elegant with Tomas Restrepo’s PipelineTesting library. Functional and integration testing of orchestrations was provided for in BizUnit, and automated deployment in preparation for test could be enabled using the bLogical Custom Tasks.

You may have used one or all of these community tools when setting up an environment with BizTalk Server 2009 and Team Foundation Server 2008, and it is still possible to use most of the functionality offered by these in BizTalk Server 2010 and Team Foundation Server 2010. If you have not had any experience with enabling automated testing of BizTalk Server applications, you may benefit from our self-paced online training course covering BizTalk testing strategies.

PipelineTesting Library

The PipelineTesting library is a mature and stable library that has been well maintained and has always remained a step ahead of what was offered out of the box with each version of BizTalk Server. It not only provides a less-clunky API, but a fuller feature set. This is best shown by a short example (although this example does not even get into the depth of what is provided in the PipelineTesting library).

Here is some rough sample code that shows basic usage of the built-in BizTalk Pipeline Testing support:

[TestMethod] 
public void TimeReportFFReceivePipeline_TimeReportFF_OutputValidates() 
{ 
    // Built-in BizTalk Pipeline Testing Support
    // (CON: Must be enabled on pipeline project before compilation) 

    // CON: Must create the pipeline ahead of time 
    TimeReportFFReceivePipeline target = new TimeReportFFReceivePipeline(); 

    // PRO: Can provide a list of input documents without loading them explicitly 
    // CON: Input documents must exist on disk 
    StringCollection inputDocuments = new StringCollection(); 
    inputDocuments.Add(Path.Combine(TestContext.TestDeploymentDir, "TimeReport_3.txt")); 

    StringCollection parts = new StringCollection(); 

    Dictionary schemas = new Dictionary(); 
    // CON: Must reference .xsd file 
    schemas.Add("TestWorkshopApplication.Messaging.TimeReportFF", @"..\..\..\Messaging\TimeReportFF.xsd"); 

    target.TestPipeline(inputDocuments, parts, schemas); 

    // CON: Must locate output messages as files 
    DirectoryInfo testDir = new DirectoryInfo(TestContext.TestDeploymentDir); 
    FileInfo[] outputList = testDir.GetFiles("*.out"); 

    Assert.IsTrue((outputList.Length > 0), "No outputs for pipeline found"); 

    foreach (FileInfo file in outputList) 
    { 

        /* Additional testing of message content */ 

    } 
}

Now compare that with a code performing roughly the same test using the PipelineTesting library:

[TestMethod] 
public void TimeReportFFInPipeline_TimeReportFF_OutputValidates() 
{ 

    // PipelineTesting Library Pipeline Testing Support 

    String sourceFile = Path.Combine(TestContext.TestDeploymentDir, "TimeReport_4.txt"); 

    // PRO: Can compose a pipeline at runtime 
    FFDisassembler ffDasm = Disassembler.FlatFile().WithDocumentSpec(typeof(TimeReportFF)); 
    ReceivePipelineWrapper target = Pipelines.Receive().WithDisassembler(ffDasm); 
    target.AddDocSpec(typeof(TimeReportFF)); 

    MessageCollection result; 

    // CON: Have to manually load input document 
    // PRO: Input document can exist only in memory 
    using (var readStream = File.OpenRead(sourceFile)) 
    { 
        IBaseMessage msg = MessageHelper.CreateFromStream(readStream); 
        result = target.Execute(msg); 
    } 

    Assert.IsTrue(result.Count > 0, "No outputs found from flat file pipeline"); 

    // PRO: Raw IBaseMessage instances of outputs are available in memory 
    foreach (IBaseMessage msg in result) 
    { 

        /* Additional testing of message content or context */ 
    } 

}

It actually doesn't take too much effort to get this library working with your BizTalk Server 2010 solutions, and in turn with Team Foundation Server 2010. You will have to upgrade the solution to the Visual Studio 2010 format, and re-reference the PipelineObjects library (exists under the \Program Files\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies folder). If you don't have NUnit installed, you can exclude the Test project from the build. Once you have it built, you're good to start writing tests against your BizTalk Server 2010 artifacts. When automating the build and test with Team Foundation Server, you will need to remember to include the .dll somewhere within source control.

BizUnit 3.1

BizUnit is a framework for performing automated integration and functional testing of BizTalk solutions. It takes a black-box approach, and requires that all artifacts are built and deployed before testing commences. If you already perform manual end-to-end testing of your BizTalk applications, you could likely benefit greatly from BizUnit over time. It provides a huge library of pre-built test steps (e.g., start BizTalk host, copy a file, wait for a file, execute a database query) that have the net effect of saving you a lot of time. Test cases, which are combinations of test steps, exist in a declarative XML format that are processed by the BizUnit class which can be invoked from within your MSTest or NUnit test assemblies.

Getting BizUnit working for BizTalk Server 2010 is not necessarily a very easy process. Before you even begin, you must consider that there are two versions currently available. The most recent version is BizUnit 4.0 Beta, which completely changes the test case format (to use XAML), and looks to be the way of the future. However, it does not look like that version has been updated in quite some time, so it is unclear when a final release will be ready. The other version available is BizUnit 3.1, which is stable and has a fully developed library of test steps along with full documentation. For the sake of this blog posting, we will go forward with 3.1, and examine some of the issues you will encounter.

This is another instance in which you will have to upgrade the solution to the Visual Studio 2010 solution file format. From there, you will notice that the solution has a project for each category of test step (e.g., BizTalk steps, LoadGen steps, MQ Series steps, Outlook automation steps, etc...). You can exclude the project for any type of step that you will not be using. Then for each of the “Steps” projects, you will need to re-reference assemblies, so that the latest versions are referenced. You might notice at this point, that the BizTalkSteps project has a dependency on the PipelineTesting library already discussed. You will definitely want to include the version that you built against the BizTalk Server 2010 binaries here. This is another place where you will need to remember to include the .dll's for both the BizUnit runtime and the steps that you will be using within source control, or simply install BizUnit on each build server if that makes more sense in your environment.

bLogical Custom Tasks

With BizTalk Server 2009, it became possible to automate builds of BizTalk applications without installing Visual Studio on the build server (though it is required to install the Project Build Component from the BizTalk installation media). It was also possible with BizTalk Server 2009 to automate tests and, with the help of community tools, automate integration and functional tests. However it was still not possible, using only out-of-the-box functionality, to include deployment as part of the build. The custom MSBuild Tasks for BizTalk by bLogical were developed to add the missing deployment step to the automated build process. Unfortunately, there are a few issues that still need to be overcome for these to work with Team Foundation Server 2010.

First, the easiest problem to deal with is in the GacHelper.cs class within the project:

namespace Blogical.Shared.Tools.BizTalkBuildTasks.Internal
{
	public class GacHelper
	{
		#region Private Fields
		const string ToolName = "bin\\gacutil.exe";
		#endregion
This path gets concatenated with the path to the .NET Framework SDK to resolve the full path to the gacutil tool. Unfortunately, this will reference the old gacutil tool. For .NET 4 assemblies, the new tool path should be "bin\\NETFX 4.0 Tools\gacutil.exe".

The second hurdle isn't so easily solved. There is a dependency, mainly in the internal TeamBuildTask base class, on classes within the Microsoft.TeamFoundation.Build.Proxy namespace. This has been obsoleted, and no longer appears in the 2010 version of the assembly. This means that, at least for now, you will now have to provide your own solution for these small missing pieces in the automated build/deployment process. Post a comment if you have found an alternative solution, or keep watching this space for updates on this.

Summary

Using BizTalk Server 2010, you can still benefit from the automated build and testing capabilities released with BizTalk Server 2009, and most of the community solutions developed to enable continuous integration. There are a few steps necessary to get everything working and setup, and a few missing pieces that you will have to build yourself, but the end result is beautiful.

Also, bear in mind that Team Foundation Server is not just about source control and it's not just about automated build or testing. It's also about issue tracking, project management, and reporting. If you are paying for a license, make sure that your organization is taking full advantage of it -- especially on your BizTalk Server integration solutions. Be sure to check our new collection of instructor-led training on Application Lifecycle Management using Visual Studio 2010 and Team Foundation Server 2010.

BizTalk Server 2010 Released – Developer Edition Now Free

by Nick Hauenstein 24. September 2010 16:24

Microsoft has just released BizTalk Server 2010, and it is now generally available! Along with this release comes an updated licensing structure that will be a relief for consultants, and companies managing multiple BizTalk environments. While the cost of the Enterprise edition has increased, the cost of the Developer edition has been eliminated. The Developer edition includes the full capabilities of the Enterprise edition, with the limitation being only that you cannot use it in production.

The pricing and licensing page sums this up saying:

Note: Many customers who deploy BizTalk Server implement separate development, testing, and production environments for their BizTalk Server 2010 solution. For the development and testing environments, you can use the free download of the BizTalk Server Developer Edition.

For the production environment, you need a valid processor license of BizTalk Server 2010 Enterprise, Standard, or Branch Edition for each processor on which you install an edition of BizTalk Server 2010.

I applaud this move by Microsoft, as it could encourage a new generation of developers to download and experiment with this powerful platform. This is a move that could drive adoption while at the same time potentially lower the TCO for those organizations managing multiple environments. Given the nature of BizTalk Server, I trust that this will not result in an equivalent of Eternal September for the BizTalk community, but don’t quote me on that remark.

To further help out developers that are new to BizTalk Server in general, we are offering a major discount on our BizTalk Developer Fundamentals online course. Simply use promo code BT2010 when you register, and you will receive $295 off a self-paced registration. This offer expires at the end of September, so act fast!

Finally, go and get BizTalk Server 2010 while it's still cached at a CDN server near you!

Tags: , ,

BizTalk | Blog | News

Are You Ready for BizTalk 2010?

by Nick Hauenstein 16. September 2010 12:00

The next major release of BizTalk Server is just around the corner. Microsoft has had some of the new features brewing since before BizTalk Server 2009. Others have been long sought after functionality that have yielded many third party components to fill the gap. In an industry where change is always on the horizon the one thing that remains constant is the question of readiness. Are you prepared for the launch of BizTalk Server 2010?

Let’s drill into some of the new features to find out what it can provide your organization.

Enhanced BizTalk Mapper

imageOne of the features, that will stand out the most as you open up Visual Studio 2010 to create your first new BizTalk Server 2010 project, is the new and improved BizTalk Mapper. New features include:

  • Ability to search a map for a given schema node, or functoid
  • Ability to cut, copy, and paste functoids and links between maps and pages
  • Cleaner display of map links based on how related they are to schema nodes within the view
  • Automatic highlighting of links and functoids related to the active selection
  • Automatic scrolling into view of links and functoids related to the active selection
  • Simplified configuration UI for functoids (e.g., the scripting functoid has a single tabbed window with which you can fully configure the connections and the script)
  • Indicative match functionality that suggests nodes to link

These features and others make dealing with large maps, re-using existing maps, and creating new maps a much more pain free experience. Many of the features the new BizTalk Mapper offers derive from a version of the BizTalk Mapper demoed at PDC in years past – they have more than delivered on what was already demonstrated.

Updated Trading Partner Management (TPM) Capabilities

imageAnother fairly major change within BizTalk Server 2010 is the way in which Parties are configured. Previously, if you had a party with whom you interacted with in multiple ways, there was not a clear way to configure and logically categorize those interactions within the Admin console. BizTalk Server 2010 solves this problem by bringing in the concepts of Business Profiles, and Trading Partner Agreements.

A Business Profile is a singular role that a trading partner could play, or a singular instance of that partner. For example you could have a trading partner that at sometimes will be a vendor, and at other times will be purchasing from your business. Those two roles would become two separate Business Profiles attached to the same party. You could also have a trading partner that has both a US and European division, those could also become separate profiles. Each profile also has related identity and protocol settings that can be configured.

A Trading Partner Agreement is a definition of how two profiles interact, including the selected protocol settings for each side of the communication.

Managing parties in this way still enables rapid change, but also allows for logical organization and consistency for those partners who interact in multiple ways with your enterprise.

Adapter & Integration Changes

Since BizTalk Server 2009, and even somewhat earlier, we have seen BizTalk adapters in a slow but steady migration over to WCF counterparts. BizTalk Server 2010 continues in this path as the SQL adapter finally rests in peace. The WCF-SQL adapter serves as its replacement (alternatively WCF-Custom using the sqlBinding binding).

In a similar turn of events, the SOAP adapter has also been deprecated in this release, and with it the BizTalk Web Services Publishing Wizard.

This slow migration to WCF-based adapters has not stopped the product team from making key updates to existing adapters however. The FTP adapter has been updated to support both FTPS (not yet SFTP), and read-only FTP locations. This functionality has been long sought after, and a few third party components had been filling this gap. That will no longer be necessary.

 

BizTalk Server Settings Dashboard

imageThis new feature is not quite as glamorous as some of the others, but is still a huge improvement. The BizTalk Server Settings Dashboard is a new UI for configuring the key performance, throttling, and tracking settings of your entire BizTalk group while offering fine grained control all the way down to the Host Instance level. It combines settings that had previously been strewn about in the Admin Console, the registry, the BizTalk configuration file, and the configuration database, into a single logically organized UI.

Further, it allows you to import/export these settings for transfer between environments (even when the naming of the hosts and host instances does not match the original environment. This is going to be a boon for controlled performance testing, and something to keep in your back pocket.

Updated Platform Support

This release of BizTalk Server will no longer be supported on Windows Server 2003. Instead the minimum requirement will be raised to Windows Server 2008 with SP2, and it will also support running on Windows Server 2008 R2. If you’re running it for development purposes, it will also support both Windows Vista with SP2 and Windows 7 on the desktop OS side of things.

For development you will now be using Visual Studio 2010 when dealing with BizTalk Server. Visual Studio is, by far, Microsoft’s best IDE to date. I was personally hesitant at first given its whimsical color scheme, however shallow that may be, but the productivity gains ultimately sold me – that, and the fact that it even runs perfectly happily on my netbook.

If you’re not running SQL Server 2008 yet in your environment, you will be. BizTalk Server 2010 supports both SQL Server 2008 SP1, and SQL Server 2008 R2.

How to Obtain BizTalk Server 2010

 

 

If you want to start diving into BizTalk Server 2010 now, you can find the link to download the Beta at Microsoft’s BizTalk Landing Page.

QuickLearn also offers a class on BizTalk Server 2010 aimed at developers who would like to update their skills to Microsoft’s latest offering. A preview of that class, and our new self-paced learning environment, can be accessed through the link on the QuickLearn Online Anytime page.

Tags: , , , , , ,

BizTalk | Blog

Windows Server AppFabric Beta 2 Available and Feature Complete

by Nick Hauenstein 1. March 2010 15:07

The .NET Endpoint blog announced this morning the availability of Windows Server AppFabric Beta 2, which can be downloaded at http://msdn.microsoft.com/appfabric. According to the announcement, Beta 2 was written to work against the RC of Visual Studio 2010, and is apparently now feature complete:

This build represents our “feature complete” milestone. That is, it contains all the features that we plan to ship in Windows Server AppFabric v1 by Q3 of 2010. For this release we focused on building a provider model for persistence, monitoring, and cache configuration stores. In our Beta 1 release we supported only the SQL Server based persistence and monitoring providers that we shipped and supported only an XML file based or SQL Server based cache configuration store. In Beta 2 we now also support providers for other database platforms or for other types of stores, in the case of persistence and cache configuration.

This is an exciting milestone for the team, and will certainly be a great time to begin evaluating Windows Server AppFabric for inclusion in upcoming projects.

Tags: , , ,

AppFabric | WF | News

Survey of the .NET Blogosphere

by Nick Hauenstein 23. February 2010 10:55

Last week I undertook a completely unscientific study of the .NET Blogosphere (as much as I loathe that term), to determine which namespaces and classes people are most excited about, confused by, or frustrated with – at least to the point that they would dedicate the time to write in their blog about them. My methods for undertaking this study were rather simplistic. I wrote a quick and dirty console application to reflect through the .NET Framework namespaces and classes, and search the internet for mentions of them alongside the terms .NET and blog. For classes whose namespaces contained no periods, the full name of the class was used as the search term. For those classes whose namespaces did contain periods, the namespace and name of the class were used as separate search terms. For example, the class System.IO.File would result in a search for “System.IO File .NET blog”, whereas the class System.String would result in a search for “System.String .NET blog”.

More than to just do a popularity contest of the different classes, I wanted to try to determine the best sources of information for each component of the framework. I wanted to see which sites seemed to consistently beat out others as authoritative sources with complete coverage of a given area. In preparation for the transition to .NET 4, I also was interested to see if the features new to .NET 3, and .NET 3.5 received similar coverage to those classes/namespaces that are used in nearly every project created. This final concern will require further testing and analysis before any conclusions can be reached.

What I did find, however, was that (perhaps unsurprisingly considering the methods) those classes/namespaces which one might use more often round out the top 10 result getters:

Class / Namespace

Result Count
System.IO 14000000
System.IO.File 12500000
System.Xml 12200000
System.Collections.Generic 10600000
System.Collections 10400000
System.Net 8280000
System 7480000
System.Web 5970000
System.Text 5950000
Microsoft.VisualBasic 5810000

I was surprised at how strong of a showing the Microsoft.VisualBasic namespace had among all other contenders. Another interesting study would be to look into those sites that are represented in the result count and find the ratio of C# to VB code contained within.

When looking only at classes, we find the following in the top 10:

Class Result Count
System.IO.File 12500000
System.Collections.IList 5250000
System.Windows.Forms.Form 5190000
System.Collections.Generic.List<T> 4360000
System.Windows.Forms.Application 4180000
System.IO.Directory 3950000
System.Windows.Forms.Control 3780000
System.IO.Stream 3380000
System.Transactions.Transaction 3080000
System.Windows.Window 2520000

From here it looks like features from .NET 2.0 (List<T>) and .NET 3.0 (System.Windows.Window) have gotten enough traction to make a big splash. Generics have had quite a long time to catch on so that’s not surprising. Features from WPF making the top 10 already is surprising (considering how much longer classes have had to be written about), and in this case may simply come as a result of the search term that the application used, which would split off Window from System.Windows.Window as its own term alongside the rest.

The top 10 sources for information about .NET would appear to be the following:

Site Top Result for X
Classes/Namespaces
www.dotnet247.com 4029
blogs.msdn.com 1343
msdn.microsoft.com 724
primates.ximian.com 255
www.codeproject.com 236
weblogs.asp.net 231
social.msdn.microsoft.com 137
msmvps.com 88
www.c-sharpcorner.com 87
www.ucertify.com 83

The number next to the name of the site indicates how many classes/namespaces for which the site is the top result. Further investigation shows that this might be inaccurate since dotnet247 seems to just index the entire framework and aggregate information from other sites in an automated fashion. Sounds like a great way to make some money from ads, but it might not be the best information source (though is still fairly genius). MSDN blogs definitely provide some serious coverage of the .NET Framework, and likely have excellent information about those classes/namespaces for which they were the top results.

Another interesting statistic that came out of this entirely informal study is that 29% of the .NET Framework (3.5) has less than 5 articles of coverage on the internet. In fact there are 389 classes or namespaces that would appear to have nothing written about them at all (according to the semi-flawed methodology described above).

You can use the download link below to download the complete results that contain all of the raw data that was analyzed, as well a pivot table, and some charts that can be used to explore it to some extent. What interesting information can you find? Has anyone else done a more formal survey of the same?

kick it on DotNetKicks.com Shout it

Tags: , ,

.NET Framework | Blog