<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>bizunit Wiki &amp; Documentation Rss Feed</title><link>http://www.codeplex.com/bizunit/Wiki/View.aspx?title=Home</link><description>bizunit Wiki Rss Description</description><item><title>Updated Wiki: Home</title><link>http://bizunit.codeplex.com/wikipage?version=36</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;&lt;b&gt;BizUnit&lt;/b&gt;&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software development projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&lt;br /&gt;&lt;br /&gt;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BizUnit 4.0&lt;/b&gt; - now available. This is a major release with significant changes making it much easier to create coded tests and also XAML tests.&lt;br /&gt;&lt;br /&gt;More information avaiable in the &lt;b&gt;Getting Started Guide&lt;/b&gt; installed with BizUnit or take a look at my &lt;b&gt;&lt;i&gt;&lt;a href="http://kevinsmi.wordpress.com/" class="externalLink"&gt;blog&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom code to do the same.&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Test Case Format&lt;/b&gt;&lt;/h2&gt;A test case can be represented as an Xml document or using the BizUnit object model, it is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt;&lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=7771" alt="TestCase.jpg" title="TestCase.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt;&lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=7772" alt="BizUnitExample.jpg" title="BizUnitExample.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;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 &lt;/li&gt;
&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. 
&lt;ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory
&lt;ul&gt;&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;&lt;/ul&gt;
 
&lt;h2&gt;&lt;b&gt;Test Steps&lt;/b&gt;&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Executing Steps Concurrently&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Reading Configuration from Context&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;&lt;b&gt;Wild Cards&lt;/b&gt;&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; 
&lt;ul&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt;
&lt;h2&gt;Validation Steps&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML validation step or a regular expression validation step to validate the data that it receives. Validation steps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;

    ...

    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()=&amp;#39;PurchaseOrder&amp;#39; and namespace-uri()=&amp;#39;http://SendMail.PurchaseOrder&amp;#39;]
                /*[local-name()=&amp;#39;PONumber&amp;#39; and namespace-uri()=&amp;#39;&amp;#39;]&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;Context Loader Steps&lt;/h2&gt;Similarly, BizUnit supports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; interface as shown below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Getting Started&lt;/b&gt;&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt;&lt;br /&gt;Finally, my apologies for the shameless plug :-), but Chapter 8 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=11374" alt="BizTalk2006Book.jpg" title="BizTalk2006Book.jpg" /&gt;&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Acknowledgments&lt;/b&gt;&lt;/h2&gt;I&amp;#39;d like to thanks the follwing people who have contributed to BizUnit in some way, either by donating test steps, identifying bugs, or by providing requirements which have subsequently been implemented. I may have missed some people off, if so, it&amp;#39;s not intensional, please drop me a mail to remind me:&lt;br /&gt;&lt;br /&gt;Iain Bapty&lt;br /&gt;Dharshana Kalahejagoda &lt;br /&gt;Jon Fancey&lt;br /&gt;Isaac Young&lt;br /&gt;Mike Becker&lt;br /&gt;Tanveer Rashid&lt;br /&gt;Young Jun Hong&lt;br /&gt;Dave Regan&lt;br /&gt;Ian Cross&lt;br /&gt;Greg Beach&lt;br /&gt;Daren Jefford&lt;br /&gt;Kevin Purcell&lt;br /&gt;Karina Apostolides&lt;br /&gt;Jon Bonnick&lt;br /&gt;Brian Milburn&lt;br /&gt;Rahmatullah Khan&lt;br /&gt;Bram Veldhoen&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Sun, 22 May 2011 14:37:25 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20110522023725P</guid></item><item><title>Updated Wiki: Home</title><link>http://bizunit.codeplex.com/wikipage?version=35</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;&lt;b&gt;BizUnit&lt;/b&gt;&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software development projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&lt;br /&gt;&lt;br /&gt;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BizUnit 4.0 Beta&lt;/b&gt; - now available. This is a major release with significant changes making it much easier to create coded tests and also XAML tests.&lt;br /&gt;&lt;br /&gt;More information avaiable in the &lt;b&gt;Getting Started Guide&lt;/b&gt; installed with BizUnit or take a look at my &lt;b&gt;&lt;i&gt;&lt;a href="http://kevinsmi.wordpress.com/" class="externalLink"&gt;blog&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom code to do the same.&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Test Case Format&lt;/b&gt;&lt;/h2&gt;A test case can be represented as an Xml document or using the BizUnit object model, it is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt;&lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=7771" alt="TestCase.jpg" title="TestCase.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt;&lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=7772" alt="BizUnitExample.jpg" title="BizUnitExample.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;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 &lt;/li&gt;
&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. 
&lt;ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory
&lt;ul&gt;&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;&lt;/ul&gt;
 
&lt;h2&gt;&lt;b&gt;Test Steps&lt;/b&gt;&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Executing Steps Concurrently&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Reading Configuration from Context&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;&lt;b&gt;Wild Cards&lt;/b&gt;&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; 
&lt;ul&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt;
&lt;h2&gt;Validation Steps&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML validation step or a regular expression validation step to validate the data that it receives. Validation steps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;

    ...

    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()=&amp;#39;PurchaseOrder&amp;#39; and namespace-uri()=&amp;#39;http://SendMail.PurchaseOrder&amp;#39;]
                /*[local-name()=&amp;#39;PONumber&amp;#39; and namespace-uri()=&amp;#39;&amp;#39;]&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;Context Loader Steps&lt;/h2&gt;Similarly, BizUnit supports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; interface as shown below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Getting Started&lt;/b&gt;&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt;&lt;br /&gt;Finally, my apologies for the shameless plug :-), but Chapter 8 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=11374" alt="BizTalk2006Book.jpg" title="BizTalk2006Book.jpg" /&gt;&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Acknowledgments&lt;/b&gt;&lt;/h2&gt;I&amp;#39;d like to thanks the follwing people who have contributed to BizUnit in some way, either by donating test steps, identifying bugs, or by providing requirements which have subsequently been implemented. I may have missed some people off, if so, it&amp;#39;s not intensional, please drop me a mail to remind me:&lt;br /&gt;&lt;br /&gt;Iain Bapty&lt;br /&gt;Dharshana Kalahejagoda &lt;br /&gt;Jon Fancey&lt;br /&gt;Isaac Young&lt;br /&gt;Mike Becker&lt;br /&gt;Tanveer Rashid&lt;br /&gt;Young Jun Hong&lt;br /&gt;Dave Regan&lt;br /&gt;Ian Cross&lt;br /&gt;Greg Beach&lt;br /&gt;Daren Jefford&lt;br /&gt;Kevin Purcell&lt;br /&gt;Karina Apostolides&lt;br /&gt;Jon Bonnick&lt;br /&gt;Brian Milburn&lt;br /&gt;Rahmatullah Khan&lt;br /&gt;Bram Veldhoen&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Wed, 23 Mar 2011 21:03:13 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20110323090313P</guid></item><item><title>Updated Wiki: Home</title><link>http://bizunit.codeplex.com/wikipage?version=34</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;&lt;b&gt;BizUnit&lt;/b&gt;&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software development projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&lt;br /&gt;&lt;br /&gt;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BizUnit 4.0 Beta&lt;/b&gt; - now available. This is a major release with significant changes making it much easier to create coded tests and also XAML tests.&lt;br /&gt;&lt;br /&gt;More information avaiable in the Getting Started Guide installed with BizUnit or take a look at my &lt;b&gt;&lt;i&gt;&lt;a href="http://kevinsmi.wordpress.com/" class="externalLink"&gt;blog&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom code to do the same.&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Test Case Format&lt;/b&gt;&lt;/h2&gt;A test case can be represented as an Xml document or using the BizUnit object model, it is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt;&lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=7771" alt="TestCase.jpg" title="TestCase.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt;&lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=7772" alt="BizUnitExample.jpg" title="BizUnitExample.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;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 &lt;/li&gt;
&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. 
&lt;ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory
&lt;ul&gt;&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;&lt;/ul&gt;
 
&lt;h2&gt;&lt;b&gt;Test Steps&lt;/b&gt;&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Executing Steps Concurrently&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Reading Configuration from Context&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;&lt;b&gt;Wild Cards&lt;/b&gt;&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; 
&lt;ul&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt;
&lt;h2&gt;Validation Steps&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML validation step or a regular expression validation step to validate the data that it receives. Validation steps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;

    ...

    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()=&amp;#39;PurchaseOrder&amp;#39; and namespace-uri()=&amp;#39;http://SendMail.PurchaseOrder&amp;#39;]
                /*[local-name()=&amp;#39;PONumber&amp;#39; and namespace-uri()=&amp;#39;&amp;#39;]&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;Context Loader Steps&lt;/h2&gt;Similarly, BizUnit supports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; interface as shown below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Getting Started&lt;/b&gt;&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt;&lt;br /&gt;Finally, my apologies for the shameless plug :-), but Chapter 8 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=11374" alt="BizTalk2006Book.jpg" title="BizTalk2006Book.jpg" /&gt;&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Acknowledgments&lt;/b&gt;&lt;/h2&gt;I&amp;#39;d like to thanks the follwing people who have contributed to BizUnit in some way, either by donating test steps, identifying bugs, or by providing requirements which have subsequently been implemented. I may have missed some people off, if so, it&amp;#39;s not intensional, please drop me a mail to remind me:&lt;br /&gt;&lt;br /&gt;Iain Bapty&lt;br /&gt;Dharshana Kalahejagoda &lt;br /&gt;Jon Fancey&lt;br /&gt;Isaac Young&lt;br /&gt;Mike Becker&lt;br /&gt;Tanveer Rashid&lt;br /&gt;Young Jun Hong&lt;br /&gt;Dave Regan&lt;br /&gt;Ian Cross&lt;br /&gt;Greg Beach&lt;br /&gt;Daren Jefford&lt;br /&gt;Kevin Purcell&lt;br /&gt;Karina Apostolides&lt;br /&gt;Jon Bonnick&lt;br /&gt;Brian Milburn&lt;br /&gt;Rahmatullah Khan&lt;br /&gt;Bram Veldhoen&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Wed, 23 Mar 2011 21:02:43 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20110323090243P</guid></item><item><title>Updated Wiki: Home</title><link>http://bizunit.codeplex.com/wikipage?version=33</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;&lt;b&gt;BizUnit&lt;/b&gt;&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software development projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&lt;br /&gt;&lt;br /&gt;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BizUnit 4.0 Beta&lt;/b&gt; - now available. This is a major release with significant changes making it much easier to create coded tests and also XAML tests.&lt;br /&gt;&lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom code to do the same.&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Test Case Format&lt;/b&gt;&lt;/h2&gt;A test case can be represented as an Xml document or using the BizUnit object model, it is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt;&lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=7771" alt="TestCase.jpg" title="TestCase.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt;&lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=7772" alt="BizUnitExample.jpg" title="BizUnitExample.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;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 &lt;/li&gt;
&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. 
&lt;ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory
&lt;ul&gt;&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;&lt;/ul&gt;
 
&lt;h2&gt;&lt;b&gt;Test Steps&lt;/b&gt;&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Executing Steps Concurrently&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Reading Configuration from Context&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;&lt;b&gt;Wild Cards&lt;/b&gt;&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; 
&lt;ul&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt;
&lt;h2&gt;Validation Steps&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML validation step or a regular expression validation step to validate the data that it receives. Validation steps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;

    ...

    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()=&amp;#39;PurchaseOrder&amp;#39; and namespace-uri()=&amp;#39;http://SendMail.PurchaseOrder&amp;#39;]
                /*[local-name()=&amp;#39;PONumber&amp;#39; and namespace-uri()=&amp;#39;&amp;#39;]&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;Context Loader Steps&lt;/h2&gt;Similarly, BizUnit supports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; interface as shown below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Getting Started&lt;/b&gt;&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt;&lt;br /&gt;Finally, my apologies for the shameless plug :-), but Chapter 8 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=11374" alt="BizTalk2006Book.jpg" title="BizTalk2006Book.jpg" /&gt;&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Acknowledgments&lt;/b&gt;&lt;/h2&gt;I&amp;#39;d like to thanks the follwing people who have contributed to BizUnit in some way, either by donating test steps, identifying bugs, or by providing requirements which have subsequently been implemented. I may have missed some people off, if so, it&amp;#39;s not intensional, please drop me a mail to remind me:&lt;br /&gt;&lt;br /&gt;Iain Bapty&lt;br /&gt;Dharshana Kalahejagoda &lt;br /&gt;Jon Fancey&lt;br /&gt;Isaac Young&lt;br /&gt;Mike Becker&lt;br /&gt;Tanveer Rashid&lt;br /&gt;Young Jun Hong&lt;br /&gt;Dave Regan&lt;br /&gt;Ian Cross&lt;br /&gt;Greg Beach&lt;br /&gt;Daren Jefford&lt;br /&gt;Kevin Purcell&lt;br /&gt;Karina Apostolides&lt;br /&gt;Jon Bonnick&lt;br /&gt;Brian Milburn&lt;br /&gt;Rahmatullah Khan&lt;br /&gt;Bram Veldhoen&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Mon, 21 Mar 2011 21:53:19 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20110321095319P</guid></item><item><title>Updated Wiki: Home</title><link>http://bizunit.codeplex.com/wikipage?version=32</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;&lt;b&gt;BizUnit&lt;/b&gt;&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software development projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&lt;br /&gt;&lt;br /&gt;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BizUnit v3.1&lt;/b&gt; - now available, new features include a &lt;b&gt;BizUnit object&lt;/b&gt;, &lt;b&gt;Excel test case runner&lt;/b&gt;, a new &lt;b&gt;UI automation&lt;/b&gt; test step library, and pluggable logging &lt;br /&gt;&lt;br /&gt;&lt;b&gt;BizUnit 4.0 Beta&lt;/b&gt; - soon to be available, more infomation &lt;a href="http://kevinsmi.wordpress.com/2010/02/22/upcoming-release-of-bizunit/" class="externalLink"&gt;here&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom code to do the same.&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Test Case Format&lt;/b&gt;&lt;/h2&gt;A test case can be represented as an Xml document or using the BizUnit object model, it is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt;&lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=7771" alt="TestCase.jpg" title="TestCase.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt;&lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=7772" alt="BizUnitExample.jpg" title="BizUnitExample.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;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 &lt;/li&gt;
&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. 
&lt;ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory
&lt;ul&gt;&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;&lt;/ul&gt;
 
&lt;h2&gt;&lt;b&gt;Test Steps&lt;/b&gt;&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Executing Steps Concurrently&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Reading Configuration from Context&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;&lt;b&gt;Wild Cards&lt;/b&gt;&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; 
&lt;ul&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt;
&lt;h2&gt;Validation Steps&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML validation step or a regular expression validation step to validate the data that it receives. Validation steps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;

    ...

    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()=&amp;#39;PurchaseOrder&amp;#39; and namespace-uri()=&amp;#39;http://SendMail.PurchaseOrder&amp;#39;]
                /*[local-name()=&amp;#39;PONumber&amp;#39; and namespace-uri()=&amp;#39;&amp;#39;]&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;Context Loader Steps&lt;/h2&gt;Similarly, BizUnit supports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; interface as shown below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Getting Started&lt;/b&gt;&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt;&lt;br /&gt;Finally, my apologies for the shameless plug :-), but Chapter 8 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=11374" alt="BizTalk2006Book.jpg" title="BizTalk2006Book.jpg" /&gt;&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Acknowledgments&lt;/b&gt;&lt;/h2&gt;I&amp;#39;d like to thanks the follwing people who have contributed to BizUnit in some way, either by donating test steps, identifying bugs, or by providing requirements which have subsequently been implemented. I may have missed some people off, if so, it&amp;#39;s not intensional, please drop me a mail to remind me:&lt;br /&gt;&lt;br /&gt;Iain Bapty&lt;br /&gt;Dharshana Kalahejagoda &lt;br /&gt;Jon Fancey&lt;br /&gt;Isaac Young&lt;br /&gt;Mike Becker&lt;br /&gt;Tanveer Rashid&lt;br /&gt;Young Jun Hong&lt;br /&gt;Dave Regan&lt;br /&gt;Ian Cross&lt;br /&gt;Greg Beach&lt;br /&gt;Daren Jefford&lt;br /&gt;Kevin Purcell&lt;br /&gt;Karina Apostolides&lt;br /&gt;Jon Bonnick&lt;br /&gt;Brian Milburn&lt;br /&gt;Rahmatullah Khan&lt;br /&gt;Bram Veldhoen&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Mon, 15 Nov 2010 21:28:49 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20101115092849P</guid></item><item><title>Updated Wiki: Home</title><link>http://bizunit.codeplex.com/wikipage?version=31</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;&lt;b&gt;BizUnit&lt;/b&gt;&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software development projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&lt;br /&gt;&lt;br /&gt;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BizUnit v3.1&lt;/b&gt; - now available, new features include a &lt;b&gt;BizUnit object&lt;/b&gt;, &lt;b&gt;Excel test case runner&lt;/b&gt;, a new &lt;b&gt;UI automation&lt;/b&gt; test step library, and pluggable logging &lt;br /&gt;&lt;br /&gt;&lt;b&gt;BizUnit 4.0 Beta&lt;/b&gt; - soon to be available, more infomation &lt;a href="http://kevinsmi.wordpress.com/2010/02/22/upcoming-release-of-bizunit/" class="externalLink"&gt;here&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom code to do the same.&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Test Case Format&lt;/b&gt;&lt;/h2&gt;A test case can be represented as an Xml document or using the BizUnit object model, it is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt;&lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=7771" alt="TestCase.jpg" title="TestCase.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt;&lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=7772" alt="BizUnitExample.jpg" title="BizUnitExample.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;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 &lt;/li&gt;
&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. 
&lt;ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory
&lt;ul&gt;&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;&lt;/ul&gt;
 
&lt;h2&gt;&lt;b&gt;Test Steps&lt;/b&gt;&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Executing Steps Concurrently&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Reading Configuration from Context&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;&lt;b&gt;Wild Cards&lt;/b&gt;&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; 
&lt;ul&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt;
&lt;h2&gt;Validation Steps&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML validation step or a regular expression validation step to validate the data that it receives. Validation steps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;

    ...

    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()=&amp;#39;PurchaseOrder&amp;#39; and namespace-uri()=&amp;#39;http://SendMail.PurchaseOrder&amp;#39;]
                /*[local-name()=&amp;#39;PONumber&amp;#39; and namespace-uri()=&amp;#39;&amp;#39;]&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;Context Loader Steps&lt;/h2&gt;Similarly, BizUnit supports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; interface as shown below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Getting Started&lt;/b&gt;&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt;&lt;br /&gt;Finally, my apologies for the shameless plug :-), but Chapter 8 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=11374" alt="BizTalk2006Book.jpg" title="BizTalk2006Book.jpg" /&gt;&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Acknowledgments&lt;/b&gt;&lt;/h2&gt;I&amp;#39;d like to thanks the follwing people who have contributed to BizUnit in some way, either by donating test steps, identifying bugs, or by providing requirements which have subsequently been implemented. I may have missed some people off, if so, it&amp;#39;s not intensional, please drop me a mail to remind me:&lt;br /&gt;&lt;br /&gt;Iain Bapty&lt;br /&gt;Dharshana Kalahejagoda &lt;br /&gt;Jon Fancey&lt;br /&gt;Isaac Young&lt;br /&gt;Mike Becker&lt;br /&gt;Tanveer Rashid&lt;br /&gt;Young Jun Hong&lt;br /&gt;Dave Regan&lt;br /&gt;Ian Cross&lt;br /&gt;Greg Beach&lt;br /&gt;Daren Jefford&lt;br /&gt;Kevin Purcell&lt;br /&gt;Karina Apostolides&lt;br /&gt;Jon Bonnick&lt;br /&gt;Brian Milburn&lt;br /&gt;Rahmatullah Khan&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Mon, 22 Feb 2010 18:57:35 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20100222065735P</guid></item><item><title>Updated Wiki: Home</title><link>http://bizunit.codeplex.com/Wiki/View.aspx?title=Home&amp;version=30</link><description>&lt;div class="wikidoc"&gt;&lt;h1&gt;&lt;b&gt;BizUnit&lt;/b&gt;&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software development projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&lt;br /&gt;&lt;br /&gt;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BizUnit v3.0 - RC1&lt;/b&gt; - now available, new features include a &lt;b&gt;BizUnit object&lt;/b&gt;, &lt;b&gt;Excel test case runner&lt;/b&gt;, a new &lt;b&gt;UI automation&lt;/b&gt; test step library, and pluggable logging &lt;br /&gt;&lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom code to do the same.&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Test Case Format&lt;/b&gt;&lt;/h2&gt;A test case can be represented as an Xml document or using the BizUnit object model, it is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt;&lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=7771" alt="TestCase.jpg" title="TestCase.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt;&lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=7772" alt="BizUnitExample.jpg" title="BizUnitExample.jpg" /&gt;&lt;br /&gt;&lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;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 &lt;/li&gt;
&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. 
&lt;ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory
&lt;ul&gt;&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;&lt;/ul&gt;
 
&lt;h2&gt;&lt;b&gt;Test Steps&lt;/b&gt;&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Executing Steps Concurrently&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;Reading Configuration from Context&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h3&gt;&lt;b&gt;Wild Cards&lt;/b&gt;&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; 
&lt;ul&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;&lt;/ul&gt;
&lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt;
&lt;h2&gt;Validation Steps&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML validation step or a regular expression validation step to validate the data that it receives. Validation steps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;

    ...

    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()='PurchaseOrder' and namespace-uri()='http://SendMail.PurchaseOrder']
                /*[local-name()='PONumber' and namespace-uri()='']&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;Context Loader Steps&lt;/h2&gt;Similarly, BizUnit supports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; interface as shown below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt;&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Getting Started&lt;/b&gt;&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt;&lt;br /&gt;Finally, my apologies for the shameless plug :-), but Chapter 8 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt;&lt;br /&gt;&lt;img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;DownloadId=11374" alt="BizTalk2006Book.jpg" title="BizTalk2006Book.jpg" /&gt;&lt;br /&gt;
&lt;h2&gt;&lt;b&gt;Acknowledgments&lt;/b&gt;&lt;/h2&gt;I'd like to thanks the follwing people who have contributed to BizUnit in some way, either by donating test steps, identifying bugs, or by providing requirements which have subsequently been implemented. I may have missed some people off, if so, it's not intensional, please drop me a mail to remind me:&lt;br /&gt;&lt;br /&gt;Iain Bapty&lt;br /&gt;Dharshana Kalahejagoda &lt;br /&gt;Jon Fancey&lt;br /&gt;Isaac Young&lt;br /&gt;Mike Becker&lt;br /&gt;Tanveer Rashid&lt;br /&gt;Young Jun Hong&lt;br /&gt;Dave Regan&lt;br /&gt;Ian Cross&lt;br /&gt;Greg Beach&lt;br /&gt;Daren Jefford&lt;br /&gt;Kevin Purcell&lt;br /&gt;Karina Apostolides&lt;br /&gt;Jon Bonnick&lt;br /&gt;Brian Milburn&lt;br /&gt;Rahmatullah Khan&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Wed, 08 Jul 2009 20:34:00 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20090708083400P</guid></item><item><title>Updated Wiki: Home</title><link>http://www.codeplex.com/bizunit/Wiki/View.aspx?title=Home&amp;version=29</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
&lt;b&gt;BizUnit&lt;/b&gt;
&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software development projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&lt;br /&gt;&lt;br /&gt;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.&lt;br /&gt;
&lt;br /&gt; &lt;br /&gt;&lt;b&gt;BizUnit v3.0 - RC1&lt;/b&gt; - now available, new features include a &lt;b&gt;BizUnit object&lt;/b&gt;, &lt;b&gt;Excel test case runner&lt;/b&gt;, a new &lt;b&gt;UI automation&lt;/b&gt; test step library, and pluggable logging &lt;br /&gt; &lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom code to do the same.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Case Format&lt;/b&gt;
&lt;/h2&gt;A test case can be represented as an Xml document or using the BizUnit object model, it is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt; &lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=7771" alt="TestCase.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt; &lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;
&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=7772" alt="BizUnitExample.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. &lt;/li&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Steps&lt;/b&gt;
&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3&gt;
Executing Steps Concurrently
&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3&gt;
Reading Configuration from Context
&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3&gt;
&lt;b&gt;Wild Cards&lt;/b&gt;
&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Validation Steps
&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML validation step or a regular expression validation step to validate the data that it receives. Validation steps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;
 
    ...
 
    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()='PurchaseOrder' and namespace-uri()='http://SendMail.PurchaseOrder']
                /*[local-name()='PONumber' and namespace-uri()='']&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Context Loader Steps
&lt;/h2&gt;Similarly, BizUnit supports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; interface as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Getting Started&lt;/b&gt;
&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt; &lt;br /&gt;Finally, my apologies for the shameless plug :-), but Chapter 10 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=11374" alt="BizTalk2006Book.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Acknowledgments&lt;/b&gt;
&lt;/h2&gt;I'd like to thanks the follwing people who have contributed to BizUnit in some way, either by donating test steps, identifying bugs, or by providing requirements which have subsequently been implemented. I may have missed some people off, if so, it's not intensional, please drop me a mail to remind me:&lt;br /&gt; &lt;br /&gt;Iain Bapty&lt;br /&gt;Dharshana Kalahejagoda &lt;br /&gt;Jon Fancey&lt;br /&gt;Isaac Young&lt;br /&gt;Mike Becker&lt;br /&gt;Tanveer Rashid&lt;br /&gt;Young Jun Hong&lt;br /&gt;Dave Regan&lt;br /&gt;Ian Cross&lt;br /&gt;Greg Beach&lt;br /&gt;Daren Jefford&lt;br /&gt;Kevin Purcell&lt;br /&gt;Karina Apostolides&lt;br /&gt;Jon Bonnick&lt;br /&gt;Brian Milburn&lt;br /&gt;Rahmatullah Khan&lt;br /&gt; &lt;br /&gt;Enjoy!&lt;br /&gt;
&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Sat, 06 Sep 2008 17:57:46 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20080906055746P</guid></item><item><title>Updated Wiki: Home</title><link>http://www.codeplex.com/bizunit/Wiki/View.aspx?title=Home&amp;version=28</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
&lt;b&gt;BizUnit&lt;/b&gt;
&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software development projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&lt;br /&gt;&lt;br /&gt;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.&lt;br /&gt;
&lt;br /&gt; &lt;br /&gt;&lt;b&gt;BizUnit v3.0 - Beta 3&lt;/b&gt; - now available, new features include a &lt;b&gt;BizUnit object&lt;/b&gt;, &lt;b&gt;Excel test case runner&lt;/b&gt; and a new &lt;b&gt;UI automation&lt;/b&gt; test step library&lt;br /&gt; &lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom code to do the same.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Case Format&lt;/b&gt;
&lt;/h2&gt;A test case can be represented as an Xml document or using the BizUnit object model, it is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt; &lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=7771" alt="TestCase.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt; &lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;
&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=7772" alt="BizUnitExample.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. &lt;/li&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Steps&lt;/b&gt;
&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3&gt;
Executing Steps Concurrently
&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3&gt;
Reading Configuration from Context
&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;h3&gt;
&lt;b&gt;Wild Cards&lt;/b&gt;
&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Validation Steps
&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML validation step or a regular expression validation step to validate the data that it receives. Validation steps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;
 
    ...
 
    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()='PurchaseOrder' and namespace-uri()='http://SendMail.PurchaseOrder']
                /*[local-name()='PONumber' and namespace-uri()='']&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Context Loader Steps
&lt;/h2&gt;Similarly, BizUnit supports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; interface as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Getting Started&lt;/b&gt;
&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt; &lt;br /&gt;Finally, my apologies for the shameless plug :-), but Chapter 10 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=11374" alt="BizTalk2006Book.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Acknowledgments&lt;/b&gt;
&lt;/h2&gt;I'd like to thanks the follwing people who have contributed to BizUnit in some way, either by donating test steps, identifying bugs, or by providing requirements which have subsequently been implemented. I may have missed some people off, if so, it's not intensional, please drop me a mail to remind me:&lt;br /&gt; &lt;br /&gt;Iain Bapty&lt;br /&gt;Dharshana Kalahejagoda &lt;br /&gt;Jon Fancey&lt;br /&gt;Isaac Young&lt;br /&gt;Mike Becker&lt;br /&gt;Tanveer Rashid&lt;br /&gt;Young Jun Hong&lt;br /&gt;Dave Regan&lt;br /&gt;Ian Cross&lt;br /&gt;Greg Beach&lt;br /&gt;Daren Jefford&lt;br /&gt;Kevin Purcell&lt;br /&gt;Karina Apostolides&lt;br /&gt;Jon Bonnick&lt;br /&gt;Brian Milburn&lt;br /&gt;Rahmatullah Khan&lt;br /&gt; &lt;br /&gt;Enjoy!&lt;br /&gt;
&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Sat, 06 Sep 2008 17:56:48 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20080906055648P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/bizunit/Wiki/View.aspx?title=Home&amp;version=27</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
&lt;b&gt;BizUnit&lt;/b&gt;
&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software development projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&lt;br /&gt;&lt;br /&gt;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.&lt;br /&gt;
&lt;br /&gt; &lt;br /&gt;&lt;b&gt;BizUnit v3.0 - Beta 3&lt;/b&gt; - now available, new features include a &lt;b&gt;BizUnit object&lt;/b&gt;, &lt;b&gt;Excel test case runner&lt;/b&gt; and a new &lt;b&gt;UI automation&lt;/b&gt; test step library&lt;br /&gt; &lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom code to do the same.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Case Format&lt;/b&gt;
&lt;/h2&gt;A test case can be represented as an Xml document or using the BizUnit object model, it is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt; &lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=7771" alt="TestCase.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt; &lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;
&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=7772" alt="BizUnitExample.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. &lt;/li&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Steps&lt;/b&gt;
&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Executing Steps Concurrently
&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Reading Configuration from Context
&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
&lt;b&gt;Wild Cards&lt;/b&gt;
&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Validation Steps
&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML validation step or a regular expression validation step to validate the data that it receives. Validation steps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;
 
    ...
 
    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt; &lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()='PurchaseOrder' and namespace-uri()='http://SendMail.PurchaseOrder']
                /*[local-name()='PONumber' and namespace-uri()='']&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
Context Loader Steps
&lt;/h2&gt;Similarly, BizUnit supports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; interface as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Getting Started&lt;/b&gt;
&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt; &lt;br /&gt;Finally, my apologies for the shameless plug :-), but Chapter 10 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=11374" alt="BizTalk2006Book.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Acknowledgments&lt;/b&gt;
&lt;/h2&gt;I'd like to thanks the follwing people who have contributed to BizUnit in some way, either by donating test steps, identifying bugs, or by providing requirements which have subsequently been implemented. I may have missed some people off, if so, it's not intensional, please drop me a mail to remind me:&lt;br /&gt; &lt;br /&gt;Dharshana Kalahejagoda &lt;br /&gt;Jon Fancey&lt;br /&gt;Isaac Young&lt;br /&gt;Mike Becker&lt;br /&gt;Tanveer Rashid&lt;br /&gt;Young Jun Hong&lt;br /&gt;Dave Regan&lt;br /&gt;Ian Cross&lt;br /&gt;Greg Beach&lt;br /&gt;Daren Jefford&lt;br /&gt;Kevin Purcell&lt;br /&gt;Karina Apostolides&lt;br /&gt;Jon Bonnick&lt;br /&gt;Brian Milburn&lt;br /&gt;Rahmatullah Khan&lt;br /&gt; &lt;br /&gt;Enjoy!&lt;br /&gt;
&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Mon, 19 May 2008 22:06:14 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080519100614P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/bizunit/Wiki/View.aspx?title=Home&amp;version=26</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
&lt;b&gt;BizUnit&lt;/b&gt;
&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software development projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&lt;br /&gt;&lt;br /&gt;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.&lt;br /&gt;
&lt;br /&gt; &lt;br /&gt;&lt;b&gt;BizUnit v3.0 - Beta 2&lt;/b&gt; - now available, new features include a &lt;b&gt;BizUnit object&lt;/b&gt;, &lt;b&gt;Excel test case runner&lt;/b&gt; and a new &lt;b&gt;UI automation&lt;/b&gt; test step library&lt;br /&gt; &lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom code to do the same.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Case Format&lt;/b&gt;
&lt;/h2&gt;A test case can be represented as an Xml document or using the BizUnit object model, it is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt; &lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=7771" alt="TestCase.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt; &lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;
&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=7772" alt="BizUnitExample.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. &lt;/li&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Steps&lt;/b&gt;
&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Executing Steps Concurrently
&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Reading Configuration from Context
&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
&lt;b&gt;Wild Cards&lt;/b&gt;
&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Validation Steps
&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML validation step or a regular expression validation step to validate the data that it receives. Validation steps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;
 
    ...
 
    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt; &lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()='PurchaseOrder' and namespace-uri()='http://SendMail.PurchaseOrder']
                /*[local-name()='PONumber' and namespace-uri()='']&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
Context Loader Steps
&lt;/h2&gt;Similarly, BizUnit supports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; interface as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Getting Started&lt;/b&gt;
&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt; &lt;br /&gt;Finally, my apologies for the shameless plug :-), but Chapter 10 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=11374" alt="BizTalk2006Book.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Acknowledgments&lt;/b&gt;
&lt;/h2&gt;I'd like to thanks the follwing people who have contributed to BizUnit in some way, either by donating test steps, identifying bugs, or by providing requirements which have subsequently been implemented. I may have missed some people off, if so, it's not intensional, please drop me a mail to remind me:&lt;br /&gt; &lt;br /&gt;Dharshana Kalahejagoda &lt;br /&gt;Jon Fancey&lt;br /&gt;Isaac Young&lt;br /&gt;Mike Becker&lt;br /&gt;Tanveer Rashid&lt;br /&gt;Young Jun Hong&lt;br /&gt;Dave Regan&lt;br /&gt;Ian Cross&lt;br /&gt;Greg Beach&lt;br /&gt;Daren Jefford&lt;br /&gt;Kevin Purcell&lt;br /&gt;Karina Apostolides&lt;br /&gt;Jon Bonnick&lt;br /&gt;Brian Milburn&lt;br /&gt;Rahmatullah Khan&lt;br /&gt; &lt;br /&gt;Enjoy!&lt;br /&gt;
&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Thu, 08 May 2008 08:10:00 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080508081000A</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/bizunit/Wiki/View.aspx?title=Home&amp;version=25</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
&lt;b&gt;BizUnit&lt;/b&gt;
&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software development projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&lt;br /&gt;&lt;br /&gt;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.&lt;br /&gt;
&lt;br /&gt; &lt;br /&gt;&lt;b&gt;BizUnit v3.0 - Beta&lt;/b&gt; - now available, new features include a &lt;b&gt;BizUnit object&lt;/b&gt;, &lt;b&gt;Excel test case runner&lt;/b&gt; and a new &lt;b&gt;UI automation&lt;/b&gt; test step library&lt;br /&gt; &lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom code to do the same.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Case Format&lt;/b&gt;
&lt;/h2&gt;A test case can be represented as an Xml document or using the BizUnit object model, it is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt; &lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=7771" alt="TestCase.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt; &lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;
&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=7772" alt="BizUnitExample.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. &lt;/li&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Steps&lt;/b&gt;
&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Executing Steps Concurrently
&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Reading Configuration from Context
&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
&lt;b&gt;Wild Cards&lt;/b&gt;
&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Validation Steps
&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML validation step or a regular expression validation step to validate the data that it receives. Validation steps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;
 
    ...
 
    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt; &lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()='PurchaseOrder' and namespace-uri()='http://SendMail.PurchaseOrder']
                /*[local-name()='PONumber' and namespace-uri()='']&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
Context Loader Steps
&lt;/h2&gt;Similarly, BizUnit supports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; interface as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Getting Started&lt;/b&gt;
&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt; &lt;br /&gt;Finally, my apologies for the shameless plug :-), but Chapter 10 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=11374" alt="BizTalk2006Book.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Acknowledgments&lt;/b&gt;
&lt;/h2&gt;I'd like to thanks the follwing people who have contributed to BizUnit in some way, either by donating test steps, identifying bugs, or by providing requirements which have subsequently been implemented. I may have missed some people off, if so, it's not intensional, please drop me a mail to remind me:&lt;br /&gt; &lt;br /&gt;Dharshana Kalahejagoda &lt;br /&gt;Jon Fancey&lt;br /&gt;Isaac Young&lt;br /&gt;Mike Becker&lt;br /&gt;Tanveer Rashid&lt;br /&gt;Young Jun Hong&lt;br /&gt;Dave Regan&lt;br /&gt;Ian Cross&lt;br /&gt;Greg Beach&lt;br /&gt;Daren Jefford&lt;br /&gt;Kevin Purcell&lt;br /&gt;Karina Apostolides&lt;br /&gt;Jon Bonnick&lt;br /&gt;Brian Milburn&lt;br /&gt;Rahmatullah Khan&lt;br /&gt; &lt;br /&gt;Enjoy!&lt;br /&gt;
&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Mon, 28 Apr 2008 07:44:18 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080428074418A</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/bizunit/Wiki/View.aspx?title=Home&amp;version=24</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
&lt;b&gt;BizUnit&lt;/b&gt;
&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software development projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&lt;br /&gt;&lt;br /&gt;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.&lt;br /&gt;
&lt;br /&gt; &lt;br /&gt;&lt;b&gt;BizUnit v3.0 - Beta&lt;/b&gt; - now available, new features include a &lt;b&gt;BizUnit object&lt;/b&gt;, &lt;b&gt;Excel test case runner&lt;/b&gt; and a new &lt;b&gt;UI automation&lt;/b&gt; test step library&lt;br /&gt; &lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom code to do the same.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Case Format&lt;/b&gt;
&lt;/h2&gt;A test case can be represented as an Xml document or using the BizUnit object model, it is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt; &lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=7771" alt="TestCase.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt; &lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;
&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=7772" alt="BizUnitExample.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. &lt;/li&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Steps&lt;/b&gt;
&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Executing Steps Concurrently
&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Reading Configuration from Context
&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
&lt;b&gt;Wild Cards&lt;/b&gt;
&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Validation Steps
&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML validation step or a regular expression validation step to validate the data that it receives. Validation steps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;
 
    ...
 
    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt; &lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()='PurchaseOrder' and namespace-uri()='http://SendMail.PurchaseOrder']
                /*[local-name()='PONumber' and namespace-uri()='']&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
Context Loader Steps
&lt;/h2&gt;Similarly, BizUnit supports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; interface as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Getting Started&lt;/b&gt;
&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt; &lt;br /&gt;Finally, my apologies for the shameless plug :-), but Chapter 10 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=11374" alt="BizTalk2006Book.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Acknowledgments&lt;/b&gt;
&lt;/h2&gt;I'd like to thanks the follwing people who have contributed to BizUnit in some way, either by donating test steps, identifying bugs, or by providing requirements which have subsequently been implemented. I may have missed some people off, if so, it's not intensional, please drop me a mail to remind me:&lt;br /&gt; &lt;br /&gt;Kalahejagoda Dharshana &lt;br /&gt;Jon Fancey&lt;br /&gt;Isaac Young&lt;br /&gt;Mike Becker&lt;br /&gt;Tanveer Rashid&lt;br /&gt;Young Jun Hong&lt;br /&gt;Dave Regan&lt;br /&gt;Ian Cross&lt;br /&gt;Greg Beach&lt;br /&gt;Daren Jefford&lt;br /&gt;Kevin Purcell&lt;br /&gt;Karina Apostolides&lt;br /&gt;Jon Bonnick&lt;br /&gt;Brian Milburn&lt;br /&gt;Rahmatullah Khan&lt;br /&gt; &lt;br /&gt;Enjoy!&lt;br /&gt;
&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Sat, 16 Feb 2008 00:19:02 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080216121902A</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/bizunit/Wiki/View.aspx?title=Home&amp;version=23</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
&lt;b&gt;BizUnit&lt;/b&gt;
&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software development projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&lt;br /&gt;&lt;br /&gt;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.&lt;br /&gt;
&lt;br /&gt; &lt;br /&gt;&lt;b&gt;BizUnit v3.0 - Beta&lt;/b&gt; - now available (new features include a &lt;b&gt;BizUnit object&lt;/b&gt;, &lt;b&gt;Excel test case runner&lt;/b&gt; and a new &lt;b&gt;UI automation&lt;/b&gt; test step library&lt;br /&gt; &lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom code to do the same.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Case Format&lt;/b&gt;
&lt;/h2&gt;A test case can be represented as an Xml document or using the BizUnit object model, it is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt; &lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=7771" alt="TestCase.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt; &lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;
&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=7772" alt="BizUnitExample.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. &lt;/li&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Steps&lt;/b&gt;
&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Executing Steps Concurrently
&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Reading Configuration from Context
&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
&lt;b&gt;Wild Cards&lt;/b&gt;
&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Validation Steps
&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML validation step or a regular expression validation step to validate the data that it receives. Validation steps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;
 
    ...
 
    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt; &lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()='PurchaseOrder' and namespace-uri()='http://SendMail.PurchaseOrder']
                /*[local-name()='PONumber' and namespace-uri()='']&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
Context Loader Steps
&lt;/h2&gt;Similarly, BizUnit supports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; interface as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Getting Started&lt;/b&gt;
&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt; &lt;br /&gt;Finally, my apologies for the shameless plug :-), but Chapter 10 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=bizunit&amp;amp;DownloadId=11374" alt="BizTalk2006Book.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Acknowledgments&lt;/b&gt;
&lt;/h2&gt;I'd like to thanks the follwing people who have contributed to BizUnit in some way, either by donating test steps, identifying bugs, or by providing requirements which have subsequently been implemented. I may have missed some people off, if so, it's not intensional, please drop me a mail to remind me:&lt;br /&gt; &lt;br /&gt;Kalahejagoda Dharshana &lt;br /&gt;Jon Fancey&lt;br /&gt;Isaac Young&lt;br /&gt;Mike Becker&lt;br /&gt;Tanveer Rashid&lt;br /&gt;Young Jun Hong&lt;br /&gt;Dave Regan&lt;br /&gt;Ian Cross&lt;br /&gt;Greg Beach&lt;br /&gt;Daren Jefford&lt;br /&gt;Kevin Purcell&lt;br /&gt;Karina Apostolides&lt;br /&gt;Jon Bonnick&lt;br /&gt;Brian Milburn&lt;br /&gt;Rahmatullah Khan&lt;br /&gt; &lt;br /&gt;Enjoy!&lt;br /&gt;
&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Sat, 16 Feb 2008 00:18:28 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080216121828A</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/bizunit/Wiki/View.aspx?title=Home&amp;version=22</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
&lt;b&gt;BizUnit&lt;/b&gt;
&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software development projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&amp;#13;&amp;#10;&amp;#13;&amp;#10;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.&amp;#13;&amp;#10;
&lt;br /&gt; &lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom code to do the same.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Case Format&lt;/b&gt;
&lt;/h2&gt;A test case represented as an Xml document and is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt; &lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/bizunit/Project/FileDownload.aspx?DownloadId=7771" alt="TestCase.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt; &lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;
&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/bizunit/Project/FileDownload.aspx?DownloadId=7772" alt="BizUnitExample.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. &lt;/li&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Steps&lt;/b&gt;
&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Executing Steps Concurrently
&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Reading Configuration from Context
&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
&lt;b&gt;Wild Cards&lt;/b&gt;
&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Validation Steps
&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML validation step or a regular expression validation step to validate the data that it receives. Validation steps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;
 
    ...
 
    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt; &lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()='PurchaseOrder' and namespace-uri()='http://SendMail.PurchaseOrder']
                /*[local-name()='PONumber' and namespace-uri()='']&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
Context Loader Steps
&lt;/h2&gt;Similarly, BizUnit supports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; interface as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Getting Started&lt;/b&gt;
&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt; &lt;br /&gt;Finally, my apologies for the shameless plug :-), but Chapter 10 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/bizunit/Project/FileDownload.aspx?DownloadId=11374" alt="BizTalk2006Book.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Acknowledgments&lt;/b&gt;
&lt;/h2&gt;I'd like to thanks the follwing people who have contributed to BizUnit in some way, either by donating test steps, identifying bugs, or by providing requirements which have subsequently been implemented. I may have missed some people off, if so, it's not intensional, please drop me a mail to remind me:&lt;br /&gt; &lt;br /&gt;Isaac Young&lt;br /&gt;Jon Fancey&lt;br /&gt;Mike Becker&lt;br /&gt;Tanveer Rashid&lt;br /&gt;Young Jun Hong&lt;br /&gt;Dave Regan&lt;br /&gt;Ian Cross&lt;br /&gt;Greg Beach&lt;br /&gt;Daren Jefford&lt;br /&gt;Kevin Purcell&lt;br /&gt;Karina Apostolides&lt;br /&gt;Jon Bonnick&lt;br /&gt;Brian Milburn&lt;br /&gt;Rahmatullah Khan&lt;br /&gt; &lt;br /&gt;Enjoy!&lt;br /&gt;
&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Sat, 28 Apr 2007 22:03:04 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20070428100304P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/bizunit/Wiki/View.aspx?title=Home&amp;version=21</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
&lt;b&gt;BizUnit&lt;/b&gt;
&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software development projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&amp;#13;&amp;#10;&amp;#13;&amp;#10;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.&amp;#13;&amp;#10;
&lt;br /&gt; &lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom code to do the same.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Case Format&lt;/b&gt;
&lt;/h2&gt;A test case represented as an Xml document and is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt; &lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/bizunit/Project/FileDownload.aspx?DownloadId=7771" alt="TestCase.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt; &lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;
&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/bizunit/Project/FileDownload.aspx?DownloadId=7772" alt="BizUnitExample.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. &lt;/li&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Steps&lt;/b&gt;
&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Executing Steps Concurrently
&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Reading Configuration from Context
&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
&lt;b&gt;Wild Cards&lt;/b&gt;
&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Validation Steps
&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML validation step or a regular expression validation step to validate the data that it receives. Validation steps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;
 
    ...
 
    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt; &lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()='PurchaseOrder' and namespace-uri()='http://SendMail.PurchaseOrder']
                /*[local-name()='PONumber' and namespace-uri()='']&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
Context Loader Steps
&lt;/h2&gt;Similarly, BizUnit supports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; interface as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Getting Started&lt;/b&gt;
&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt; &lt;br /&gt;Finally, my apologies for the shameless plug :-), but Chapter 10 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Acknowledgments&lt;/b&gt;
&lt;/h2&gt;I'd like to thanks the follwing people who have contributed to BizUnit in some way, either by donating test steps, identifying bugs, or by providing requirements which have subsequently been implemented. I may have missed some people off, if so, it's not intensional, please drop me a mail to remind me:&lt;br /&gt; &lt;br /&gt;Isaac Young&lt;br /&gt;Jon Fancey&lt;br /&gt;Mike Becker&lt;br /&gt;Tanveer Rashid&lt;br /&gt;Young Jun Hong&lt;br /&gt;Dave Regan&lt;br /&gt;Ian Cross&lt;br /&gt;Greg Beach&lt;br /&gt;Daren Jefford&lt;br /&gt;Kevin Purcell&lt;br /&gt;Karina Apostolides&lt;br /&gt;Jon Bonnick&lt;br /&gt;Brian Milburn&lt;br /&gt;Rahmatullah Khan&lt;br /&gt; &lt;br /&gt;Enjoy!&lt;br /&gt;
&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Sat, 24 Mar 2007 22:23:13 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20070324102313P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/bizunit/Wiki/View.aspx?title=Home&amp;version=20</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
&lt;b&gt;BizUnit&lt;/b&gt;
&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software development projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&amp;#13;&amp;#10;&amp;#13;&amp;#10;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.&amp;#13;&amp;#10;
&lt;br /&gt; &lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom code to do the same.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Case Format&lt;/b&gt;
&lt;/h2&gt;A test case represented as an Xml document and is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt; &lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/bizunit/Project/FileDownload.aspx?DownloadId=7771" alt="TestCase.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt; &lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;
&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/bizunit/Project/FileDownload.aspx?DownloadId=7772" alt="BizUnitExample.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. &lt;/li&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Steps&lt;/b&gt;
&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Executing Steps Concurrently
&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Reading Configuration from Context
&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
&lt;b&gt;Wild Cards&lt;/b&gt;
&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Validation Steps
&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML validation step or a regular expression validation step to validate the data that it receives. Validation steps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;
 
    ...
 
    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt; &lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()='PurchaseOrder' and namespace-uri()='http://SendMail.PurchaseOrder']
                /*[local-name()='PONumber' and namespace-uri()='']&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
Context Loader Steps
&lt;/h2&gt;Similarly, BizUnit supports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; interface as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Getting Started&lt;/b&gt;
&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt; &lt;br /&gt;Finally, my apologies for the shameless plug :-), but Chapter 10 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt; &lt;br /&gt;Enjoy!&lt;br /&gt;
&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Tue, 06 Mar 2007 22:49:05 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20070306104905P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/bizunit/Wiki/View.aspx?title=Home&amp;version=19</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
&lt;b&gt;BizUnit&lt;/b&gt;
&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software developements projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&amp;#13;&amp;#10;&amp;#13;&amp;#10;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.
&lt;br /&gt; &lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom cod to do the same.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Case Format&lt;/b&gt;
&lt;/h2&gt;A test case represented as an Xml document and is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt; &lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/bizunit/Project/FileDownload.aspx?DownloadId=7771" alt="TestCase.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt; &lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;
&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/bizunit/Project/FileDownload.aspx?DownloadId=7772" alt="BizUnitExample.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. &lt;/li&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Steps&lt;/b&gt;
&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Executing Steps Concurrently
&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Reading Configuration from Context
&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
&lt;b&gt;Wild Cards&lt;/b&gt;
&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Validation Steps
&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML vlaidation step or a regular expression validation step to validate the data that it receives. Validation seps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;
 
    ...
 
    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt; &lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=
                &amp;quot;/*[local-name()='PurchaseOrder' and namespace-uri()='http://SendMail.PurchaseOrder']
                /*[local-name()='PONumber' and namespace-uri()='']&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
Context Loader Steps
&lt;/h2&gt;Simlarly, BizUnit spports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; iterface as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Getting Started&lt;/b&gt;
&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt; &lt;br /&gt;Finally, my appologies for the shameless plug :-), but Chapter 10 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt; &lt;br /&gt;Enjoy!&lt;br /&gt;
&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Sat, 03 Mar 2007 12:43:06 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20070303124306P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/bizunit/Wiki/View.aspx?title=Home&amp;version=18</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
&lt;b&gt;BizUnit&lt;/b&gt;
&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software developements projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&amp;#13;&amp;#10;&amp;#13;&amp;#10;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.
&lt;br /&gt; &lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom cod to do the same.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Case Format&lt;/b&gt;
&lt;/h2&gt;A test case represented as an Xml document and is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt; &lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/bizunit/Project/FileDownload.aspx?DownloadId=7771" alt="TestCase.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt; &lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;
&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/bizunit/Project/FileDownload.aspx?DownloadId=7772" alt="BizUnitExample.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. &lt;/li&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Steps&lt;/b&gt;
&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Executing Steps Concurrently
&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Reading Configuration from Context
&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
&lt;b&gt;Wild Cards&lt;/b&gt;
&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Validation Steps
&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML vlaidation step or a regular expression validation step to validate the data that it receives. Validation seps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;
 
    ...
 
    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt; &lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=&amp;quot;/*[local-name()='PurchaseOrder' and namespace-uri()='http://SendMail.PurchaseOrder']/*[local-name()='PONumber' and namespace-uri()='']&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
Context Loader Steps
&lt;/h2&gt;Simlarly, BizUnit spports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; iterface as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Getting Started&lt;/b&gt;
&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt; &lt;br /&gt;Finally, my appologies for the shameless plug :-), but Chapter 10 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I co-authored discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt; &lt;br /&gt;Enjoy!&lt;br /&gt;
&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Sat, 03 Mar 2007 10:52:54 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20070303105254A</guid></item><item><title>UPDATED WIKI: Home</title><link>http://www.codeplex.com/bizunit/Wiki/View.aspx?title=Home&amp;version=17</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
&lt;b&gt;BizUnit&lt;/b&gt;
&lt;/h1&gt;The adoption of an automated testing strategy is fundamental in reducing the risk associated with software developements projects, it is key to ensuring that you deliver high quality software. Often, the overhead associated with developing automated tests is seen as excessive and a reason to not adopt automated testing.&amp;#13;&amp;#10;&amp;#13;&amp;#10;BizUnit enables automated tests to be rapidly developed. BizUnit is a flexible and extensible declarative test framework targeted that rapidly enables the automated testing of distributed systems, for example it is widely used to test BizTalk solutions. BizUnit is fully extensible. 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 &amp;#8216;fixing up&amp;#8217; of Url&amp;#8217;s for different environments, e.g. test, staging and production environments. Defining test cases in XML enables test cases to be auto-generated.
&lt;br /&gt; &lt;br /&gt;BizUnit is a framework and as such does not have any dependency on either NUnit of VS Unit Testing, either of these make a great way to drive BizUnit test cases, though equally you could write custom cod to do the same.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Case Format&lt;/b&gt;
&lt;/h2&gt;A test case represented as an Xml document and is made up of three stages, &lt;b&gt;&lt;i&gt;test setup&lt;/i&gt;&lt;/b&gt;, &lt;b&gt;&lt;i&gt;test execution&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;test cleanup&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt;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.&lt;br /&gt;BizUnit also has the notion of TestGroupSetup and TestGroupTearDown, these are test cases that are executed at the beginning and end of a suite of unit tests.&lt;br /&gt; &lt;br /&gt;The diagram below illustrates the format of a test case.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/bizunit/Project/FileDownload.aspx?DownloadId=7771" alt="TestCase.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In addition to test steps, BizUnit has the notion of &lt;b&gt;&lt;i&gt;validation&lt;/i&gt;&lt;/b&gt; steps and &lt;b&gt;&lt;i&gt;context loader&lt;/i&gt;&lt;/b&gt; 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.&lt;br /&gt; &lt;br /&gt;A test step within a test case can be marked with the attribute - &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; which causes subsequent test steps to be started before it has completed. In addition test steps maybe marked with the attribute - &lt;b&gt;&lt;i&gt;failOnError&lt;/i&gt;&lt;/b&gt;, 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.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Lets look at an Example Scenario...&lt;/b&gt;
&lt;/h2&gt;BizUnit takes a black box approach to testing solutions, lets look at the BizTalk 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.&lt;br /&gt; &lt;br /&gt;&lt;img src="http://www.codeplex.com/bizunit/Project/FileDownload.aspx?DownloadId=7772" alt="BizUnitExample.jpg" /&gt;&lt;br /&gt; &lt;br /&gt;In order to test this scenario, a BizUnit test case is defined that has 5 test steps:&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;The MSMQReadStep waits for a message to appear on an MSMQ queue. &lt;/li&gt;&lt;ul&gt;
&lt;li&gt;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 &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;The FileValidateStep waits for a FILE to be written to a given directory&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;When it reads the FILE it validates the data using the RegExValidationStep validation step since the FILE picked up was a flat file format &lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;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 &lt;/li&gt;&lt;li&gt;Finally, DBQueryStep is used to check that all of the BAM data has been successfully written to the BAMPrimaryImportDB&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Test Steps&lt;/b&gt;
&lt;/h2&gt;A test step is a .NET class which implements the &lt;b&gt;&lt;i&gt;ITestStep&lt;/i&gt;&lt;/b&gt; interface:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface ITestStep
{
    void Execute(XmlNode testConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;BizUnit will create and execute the test steps as dictated by the Xml test case. The test case will list the steps that need to be excuted in each stage of the test. The example below will cause BizUnit to create the &lt;i&gt;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&lt;/i&gt;. BizUnit uses the &lt;b&gt;&lt;i&gt;assemblyPath&lt;/i&gt;&lt;/b&gt; and &lt;b&gt;&lt;i&gt;typeName&lt;/i&gt;&lt;/b&gt; to load and create the type:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Executing Steps Concurrently
&lt;/h3&gt;Test steps can be maked to execute concurrently by decorating them with the &lt;b&gt;&lt;i&gt;runConcurrently&lt;/i&gt;&lt;/b&gt; attribute:&lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpRequestResponseStep&amp;quot; runConcurrently=&amp;quot;true&amp;quot;&amp;gt;
    ...
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
Reading Configuration from Context
&lt;/h3&gt;BizUnit enables state to be flowed between test steps using the Context object, subsequent steps may read configuration from the Context object which was written by a previous test step, this is acheived using the &lt;b&gt;&lt;i&gt;takeFromCtx&lt;/i&gt;&lt;/b&gt; attribute within a steps configuration. For example:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.HttpPostStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;.\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;    
    &amp;lt;DestinationUrl takeFromCtx=&amp;quot;HTTPDest&amp;quot;&amp;gt;http://localhost/TestFrameworkDemo/BTSHTTPReceive.dll&amp;lt;/DestinationUrl&amp;gt;
    &amp;lt;RequestTimeout&amp;gt;60000&amp;lt;/RequestTimeout&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h3&gt;
&lt;b&gt;Wild Cards&lt;/b&gt;
&lt;/h3&gt;BizUnit supports wild card for reading configuration, the following wild cards are supported&lt;br /&gt; &lt;br /&gt;&lt;ul&gt;
&lt;li&gt;&lt;b&gt;&lt;i&gt;%DateTime%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the current date time in the format HHmmss-ddMMyyyy &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%ServerName%&lt;/i&gt;&lt;/b&gt; - will replace the wild card with the name of the server BizUnit is being executed on &lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;i&gt;%Guid%&lt;/i&gt;&lt;/b&gt; - will be replaced by a new Guid&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;For example, for the test step configuration below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileCreateStep&amp;quot;&amp;gt;
    &amp;lt;SourcePath&amp;gt;..\..\..\TestData\InDoc1.xml&amp;lt;/SourcePath&amp;gt;         
    &amp;lt;CreationPath&amp;gt;..\..\..\Rec_03\TransactionId_%Guid%_%ServerName%.xml&amp;lt;/CreationPath&amp;gt;
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;CreationPath becomes &lt;i&gt;&amp;quot;..\..\..\Rec&lt;/i&gt;03\TransactionId&lt;i&gt;12345678-D6AB-4aa9-A772-938972E3FD51&lt;/i&gt;ZEUS001.xml&amp;quot;_&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Validation Steps
&lt;/h2&gt;BizUnit supports the notion of validation steps which may be nested within test steps which support validation. This means that an MSMQ read step may use an XML vlaidation step or a regular expression validation step to validate the data that it receives. Validation seps need to implement the &lt;b&gt;&lt;i&gt;IValidationStep&lt;/i&gt;&lt;/b&gt; interface. &lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IValidationStep
{
    void ExecuteValidation(Stream data, XmlNode validatorConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;A test step may use the Context object utilities to execute the appropriate validation step as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public void Execute(XmlNode testConfig, Context context)
{
    XmlNode validationConfig = testConfig.SelectSingleNode(&amp;quot;ValidationStep&amp;quot;);
    MemoryStream data = null;
 
    ...
 
    context.ExecuteValidator( data, validationConfig );
}
&lt;/pre&gt; &lt;br /&gt;The test step snippet below illustrates how a validation step is embeded in a file read step:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
&amp;lt;TestStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.FileValidateStep&amp;quot;&amp;gt;
    &amp;lt;Timeout&amp;gt;3000&amp;lt;/Timeout&amp;gt;
    &amp;lt;Directory&amp;gt;..\..\..\Rec_03\&amp;lt;/Directory&amp;gt;
    &amp;lt;SearchPattern&amp;gt;TransactionId_*.xml&amp;lt;/SearchPattern&amp;gt;
    &amp;lt;DeleteFile&amp;gt;true&amp;lt;/DeleteFile&amp;gt;
			
    &amp;lt;ValidationStep assemblyPath=&amp;quot;&amp;quot; typeName=&amp;quot;Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlValidationStep&amp;quot;&amp;gt;
        &amp;lt;XmlSchemaPath&amp;gt;..\..\..\TestData\PurchaseOrder.xsd&amp;lt;/XmlSchemaPath&amp;gt;
        &amp;lt;XmlSchemaNameSpace&amp;gt;http://SendMail.PurchaseOrder&amp;lt;/XmlSchemaNameSpace&amp;gt;
        &amp;lt;XPathList&amp;gt;
            &amp;lt;XPathValidation query=&amp;quot;/*[local-name()='PurchaseOrder' and namespace-uri()='http://SendMail.PurchaseOrder']/*[local-name()='PONumber' and namespace-uri()='']&amp;quot;&amp;gt;PONumber_0&amp;lt;/XPathValidation&amp;gt;
        &amp;lt;/XPathList&amp;gt;
    &amp;lt;/ValidationStep&amp;gt;			
&amp;lt;/TestStep&amp;gt;
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
Context Loader Steps
&lt;/h2&gt;Simlarly, BizUnit spports context loader steps, which are responsible for loading data into the BizUnit context. These types of need to implement the &lt;b&gt;&lt;i&gt;IContextLoaderStep&lt;/i&gt;&lt;/b&gt; iterface as shown below:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
public interface IContextLoaderStep
{
    void ExecuteContextLoader(Stream data, XmlNode contextConfig, Context context);
}
&lt;/pre&gt; &lt;br /&gt;&lt;h2&gt;
&lt;b&gt;Getting Started&lt;/b&gt;
&lt;/h2&gt;The best way to get started is to download the latest version, install it and then take a look at the SDK samples. All the source is currently included, so feel free to take a closer look at the code. All the test steps along with the framework itself are documented in the .CHM that is installed.&lt;br /&gt; &lt;br /&gt;Finally, my appologies for the shameless plug :-), but Chapter 10 of &lt;b&gt;&lt;i&gt;&lt;a href="http://www.amazon.com/Professional-BizTalk-Server-Darren-Jefford/dp/0470046422/ref=pd_bbs_sr_4/103-9081803-2555041?ie=UTF8&amp;amp;s=books&amp;amp;qid=1172915706&amp;amp;sr=8-4" class="externalLink"&gt;Professional BizTalk Server 2006&lt;/a&gt;&lt;/i&gt;&lt;/b&gt; book which I am a co-author of discusses in more detail how BizUnit may be used as an integral part of your development process, and how it may be used to drive stress and performance testing. &lt;br /&gt; &lt;br /&gt;Enjoy!&lt;br /&gt;
&lt;/div&gt;</description><author>kevinsmi</author><pubDate>Sat, 03 Mar 2007 10:50:53 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20070303105053A</guid></item></channel></rss>