This post follows on from yesterday’s post: Creating
BizUnit Test Cases for comparing Xml Files
If you are using the XmlValidationStep/XmlValidationStepEx BizUnit
steps and using XPath validation, then it can be a pain to write all these XPathValidation
statements by hand.
So I wrote a utility to generate the XPath statements for you.
In fact, it generates the entire BizUnit Test Case for validating an Xml file.
Once it has been generated, all you have to do is:
a. Change the location to copy input files and look for output files (or change
completely if not using the File adapter)
b. Change the location/namespace of the Xsd file (if performing validation)
c. Edit the list of XPath statements to remove any which are not necessary.
Generating a Test Case can be performed:
The utility (and installation/help files) can be found here:
DanSharp XmlViewer
Note: I also have a suggestion for an improved version of XmlValidationStep –
you can find this here:
BizUnit:
XmlValidationStep using .NET 2.0 Schema Validation
This new version combines XmlValidationStep and XmlValidationStepEx into
a single step, allows you to not specify a namespace for the schema in the Test Case,
and uses the newer .NET 2.0 XmlReaderSettings mechanism
for validating schemas. I compile it into my own utility assembly and then refer to
it from a BizUnit TestCase via the assemblyPath attribute.