Issue with XmlValidationStep

May 2, 2012 at 12:47 PM

Hi Team

I am new to the BizUnit Framework. I have been playing around with the framework to do the unit testing of my project.

i am having two issue.

1) Suppose i am using the xmlValidation steps to validate the xml against the schema. If the schema contain wrong namespace, even then xmlstep is working successfully. I expect the step to fail with the error the namespace doesn;t match. This is the snippet of the code, i am using:

 var ProcessTestCase = new TestCase();
   


            //Create a validating read step
            //We should only have one file in the directory
            var validatingFileReadStep = new FileReadMultipleStep
            {
               DirectoryPath = @"..\..\..\Tests\TestMessages\",
                SearchPattern="Request.xml",
                ExpectedNumberOfFiles = 1,
                Timeout = 3000,
                DeleteFiles = false
            };

            //Create an XML Validation step
            //This will check the result against the XSD for the document

            var validateInput = new XmlValidationStep();
            var inputSchemaType = new SchemaDefinition
            {
                XmlSchemaPath = @"..\..\..\Projects\Request.xsd",
                XmlSchemaNameSpace = "http://schemas.com/Request"
            };


            validateInput.XmlSchemas.Add(inputSchemaType);

            validatingFileReadStep.SubSteps.Add(validateInput);


            ProcessTestCase .ExecutionSteps.Add(validatingFileReadStep);
var bizUnit = new BizUnit.BizUnit(ProcessTestCase );
            var document = new XmlDocument();
           
                bizUnit.RunTest();
           
The Content of my xml is:

 <Request xmlns="http://schemas.com/Request12"></Request>

I have intentinally given the worng namespace in the xml. But the above test is getting passed without any error.

 

2) In Place of Request xml, if i give some other xml,in that case also same behaviour. test is getting passed.

Validation only works when i have xml tagname different in xml.

 

Please help me.

 

Thanks

Deepak Sanghi