Search code examples
biztalkbiztalk-2010bizunit

Execute BizUnit 4.0 XML Test Case


Hi i have created a an xml test case in bizunit 4.0 called test1.xml

The problem I have is how to run the test. All the examples i find are for bizunit 2.0 and 3.0, but not for 4.0. In the examples i found it says to do this:

 BizUnit.BizUnit bizUnit = new BizUnit.BizUnit("testl.xml");
 bizUnit.RunTest();

but i get a note saying it is deprecated.


Solution

  • I'm using .net unit tests and calling bizunit from code

    Here's an example

        // create list of files
        TestGeneratedFiles = new System.Collections.Generic.List<String>();
    
        var TestCase = new BizUnit.Xaml.TestCase { Name = "Interface128UnitTestSetup" };
    
        //Create the file validate step
        var testStep = new FileReadMultipleStep
        {
            DirectoryPath = inputPath,
            SearchPattern = InputTemplate,
            ExpectedNumberOfFiles = 1,
            Timeout = 3000,
            DeleteFiles = false
        };
    
        //Create an XML Validation step
        //This will check against the XSD for the document
        var validation = new XmlValidationStep();
        var schemaSummary = new SchemaDefinition
        {
            // test deployment copies this file to test directory
            XmlSchemaPath = @"Publish_Employee.xsd",
            XmlSchemaNameSpace = "http://AMC.Oracle.Employee"
        };
        validation.XmlSchemas.Add(schemaSummary);
    
        TestCase.ExecutionSteps.Add(testStep);
    
        // run the test case
        var bizUnit = new BizUnit.BizUnit(TestCase);
        bizUnit.RunTest();