简体   繁体   中英

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.

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();

For me this worked (w/o warning):

TestCase tc = TestCase.LoadFromFile("test1.xml");
BizUnit.BizUnit bizUnit = new BizUnit.BizUnit(tc);
bizUnit.RunTest();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM