2012-04-04 66 views
1

嗨我已经在bizunit 4.0中创建了一个名为test1.xml的xml测试用例执行BizUnit 4.0 XML测试用例

我遇到的问题是如何运行测试。我发现的所有例子都是针对bizunit 2.0和3.0,但不是针对4.0。在例子中,我发现它这样做:

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

但我得到一个说明它已被弃用。

回答

2

我使用的.NET单元测试和从代码中

这里呼吁bizunit是一个例子

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

对我来说,这个工作(W/O警告):

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