Partager via


BizUnit 2006 is Released – BizTalk 2006 and Visual Studio 2005


I’ve finally got around to finishing off BizUnit 2006 - v2.1 just in time for the BizTalk 2006 GA, this version is targeted at BizTalk 2006 and Visual Studio 2005 and is built using .Net 2.0. I’ve been using the new unit testing capability in Visual Studio 2005 to drive BizUnit for a while now instead of NUnit and have to say I’m pretty pleased with it.

In case you're not aware, BizUnit is a declarative test framework targeted at but not restricted to the automated testing of BizTalk solutions. BizUnit is fully extensible, v2.0 has had over 2077 downloads to date and there are many customers world wide using it to drive up the quality of their BizTalk solutions. Its approach is to enable test cases to be constructed from generic reusable test steps, test cases are defined in XML which allows them to be auto-generated and also enables the ‘fixing up’ of Url’s for different environments, e.g. test, staging and production environments.

This version adds some additional test steps:

  • FactBasedRuleEngineStep
  • PerfmonCountersStep
  • DBExecuteNonQueryStep
  • DBQueryReturnXmlStep
  • ExportDBDataToDataSetStep
  • HostConductorStep
  • ImportDatasetToDBStep

And some new Validation Steps:

  • CodeValidationStep
  • XmlValidationStepEx

I’ve also added wild card support for reading configuration, the following wild cards are supported, let me know if there are others you’d like to see supported:

  • %DateTime% - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy

  • %ServerName% - will replace the wild card with the name of the server BizUnit is being executed on

  • %Guid% - will be replaced by a new Guid

For example, for the test step configuration below:

<TestStep assemblyPath="" typeName="Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep">

      <SourcePath>..\..\..\TestData\InDoc1.xml</SourcePath>

      <CreationPath>..\..\..\Rec_03\TransactionId_ %Guid% _ %ServerName% .xml</CreationPath>

</TestStep>

CreationPath becomes " ..\..\..\Rec_03\TransactionId_12345678-D6AB-4aa9-A772-938972E3FD51_ZEUS001.xml"

 

If you're new to BizUnit here's a brief overview of how it works...

Test Case Format

A test case is made up of three stages, test setup, test execution and test cleanup, the cleanup stage is always executed (even if the main execution stage fails) and intended to leave the platform in the same state that it started.

Each stage may consist of zero or more test steps, test steps are in general autonomous, state can be flowed between them if required using the ‘context’ object that is passed to each test step by the framework.

BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the begginning and end of a suite of unit tests.

The diagram below illustrates the format of a test case.

 

 

 

In addition to test steps, BizUnit has the notion of validation steps and context loader steps. These can be thought of as sub-steps and can in general be independantly executed from any test step. For example, an MSMQ-read step might be used to read and validate both Xml and Flat File data from a queue, the same step can be used with both the RegExValidationStep and the XmlValidationStep to validate the data read.

 

A test step within a test case can be marked with the attribute - runConcurrently which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - failOnError, setting it to false cause BizUnit to ignore a failure of that test step, this is particularly useful for the setup and cleanup stages of test cases.

 

Lets look at an Example Scenario...

BizUnit takes a black box approach to testing solutions, if you look at the scenario below, a BizTalk solution receives a request-response message over HTTP, the message is routed to an Orchestration which, sends a message to MSMQ and another to a FILE drop, the Orchestration waits for a FILE to be received, after which the Orchestration sends the response back to the waiting HTTP client. The solution also uses BAM, writing business data to the BAM database.

 

In order to test this scenario, a BizUnit test case is defined that has 5 test steps:

  1. The HttpRequestResponseStep sends the request to the two-way receive port and waits for the response. This step is executed concurrently so that the other test steps may execute whilst it waiting for the response

  2. The MSMQReadStep waits for a message to appear on an MSMQ queue, when it reads the message it uses the XmlValidationStep to perform schema validation and also execute a number of XPath expression to ensure the message contains the correct data

  3. The FileValidateStep waits for a FILE to be written to a given directory, when it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format

  4. The FileCreateStep creates a new FILE in the specified directory containing the data that the backend system would typically create. This allows the Orchestration to complete and send the response back to the waiting HttpRequestResponseStep step

  5. Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB

 

Finally, I'd like to give a big thanks to the following who have contributed new steps, ideas, etc to this version of BizUnit, my apologies if I have missed off anyone, it’s not intentional just my disorganisation!, please let me know if that is the case and I’ll add you:

Jon Fancey

Mike Becker

Tanveer Rashid

Young Jun Hong

 

If you find bugs, have new steps or ideas/requirements for new features that you'd like incorporated let me know.

Enjoy!

Comments

  • Anonymous
    April 14, 2006
    [Kevin&amp;rsquo;s] finally got around to finishing off BizUnit 2006 - v2.1, this version is targeted at...

  • Anonymous
    April 19, 2006
    Kevin B Smith has released BizUnit 2006 to GotDotNet targeted BizTalk Server 2006 and Visual Studio 2005...

  • Anonymous
    April 20, 2006
    Kevin has released BizUnit 2006, a framework for unit testing BizTalk solution artifacts. This is a must...

  • Anonymous
    May 02, 2006
    I am trying to put all the links in one place...
    Biztalk 2006 Resources&amp;nbsp;
    MSDN Biztalk 2006&amp;nbsp;Online...

  • Anonymous
    May 03, 2006
    I think the BizUnit is a must tool for BizTalk developers. But, as for me, it isn’t easy to memorize...

  • Anonymous
    May 05, 2006
    The following links to .NET resources have been collated over time with the assistance of colleagues.&amp;nbsp;...

  • Anonymous
    May 18, 2006
    The new version of BizUnit is out. It now works on the .Net 2.0 code and uses the unit testing capabilities...

  • Anonymous
    May 18, 2006
    The new version of BizUnit is out. It now works on the .Net 2.0 code and uses the unit testing capabilities...

  • Anonymous
    October 14, 2006
    PingBack from http://www.jasonhyland.com/?p=66

  • Anonymous
    September 17, 2007
    how to hide comments code myspace