Generate XML test examples from XSD
Overview
You can easily combine xslt transformations with CAM templates that generate XML test cases and examples from XSD schema. The jCAM tool implementation supports this via the included saxon xslt processor. The XSLT scripts provided in the camprocessor tool from Sourceforge allow you to ingest your original XSD schema, then make refinements and changes to the content model and structure. Then when you are ready you can simply create a range of example XML instances quickly and easily with a variety of output generation options. There is also a content hinting option so that you can create realistic test cases not just random XML.
Tutorial on generating XML test examples from XSD
A tutorial is available that shows the steps needed to ingest an existing XSD schema into a CAM template and then generate XML examples and test instances from that.
The tutorial is available here.
Notes on the xslt for generating XML test instances
The xslt used in the camprocessor tool is available from svn download at Sourceforge and consists of a set of tools including:
- The xsd2cam.xslt that ingests the XSD schema into the CAM template
- The cam-2-example.xslt that creates the XML instances from the CAM template
- Export and import of content hints.xml for use with the CAM templates.
<!-- Provided "as is" License: Creative Commons - http://creativecommons.org/licenses/by-sa/3.0/ Author: David RR Webber, February, 2008 -->
CAM Wiki