2012-04-04 64 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();