Systematic document generation from XML Schema Antonia Bertolino, Jinghua Gao, Eda Marchetti, Andrea Polini name.surname@isti.cnr.it Istituto di Scienza e Tecnologie dell'Informazione “A. Faedo" (ISTI-CNR), Pisa TAXI TAXI SE Day @ Rutgers 4/22/08 1
Agenda XML and XML Schema Motivating XML-based Partition Testing (XPT) Category Partition(CP) & Mapping from CP to XPT XPT Methodology TAXI Tool Applications Conclusion TAXI TAXI SE Day @ Rutgers 4/22/08 2
The eXtensible Markup Language(XML) The eXtensible Markup Language (XML) is a Markup Language which is today a de-facto standard to store information and data. XML documents are tree structured documents in which data are formatted/organised using tags card <?xml version="1.0" encoding="ISO88591"?> <card> <name>John Doe</name> phone email name title <title>CEO, Widget Inc.</title> <email>john.doe@widget.com</email> <phone>(202) 4561414</phone> </card> CEO, Widget john.doe@ (202) John Doe Inc widget.com 4561414 TAXI TAXI SE Day @ Rutgers 4/22/08 3
XML & XML Schema XML Schema provides a means for defining the structure and content of XML documents In the open networked world, XML Schema support interoperability between independently developed applications Chinese Italian TAXI TAXI SE Day @ Rutgers 4/22/08 4
Automatic XML-Based Testing and Benchmarking What we would like to achieve TAXI TAXI SE Day @ Rutgers 4/22/08 5
Automatic XML-Based Testing and Benchmarking EASY WAY Some tools like that exist: XMLSpy, sunXMLGenerator, … TAXI TAXI SE Day @ Rutgers 4/22/08 6
Our proposal: A Systematic Automatic Approach XML-based Partition Testing XPT The approach has been inspired at-large by the well-known Category Partition methodology for systematic semi-automated test generation … ..or, you can think of it as grammar-based generation, on the XSD syntax, although we have also introduced practical rules TAXI TAXI SE Day @ Rutgers 4/22/08 7
Mapping CP to XPT CP XPT Analyze Specifications Preprocessor Identify Functional Units Identify Sub-Schema Sets Partition Categories Identify Types Selecte Choices Partition Values and Structures Determine Constraints Determine “valid/invalid” constraints Generate Test Specification Generate Intermediate Instances Generate Test Cases Generate Final Instances TAXI TAXI SE Day @ Rutgers 4/22/08 8
Identification of Sub-Schema Sets <choice> elements partition the XML Schema into Mapping from CP to XPT distinct set corresponding to the CP functional units Analyze preprocessor Specifications XML Schema XML Schema XML Schema Identify Sub- Identify Schema Sets Functional Units A B sequence sequence Partition Identify Types Categories A 1 1 sequence sequence choice Partition B Selecte Choices Values and Structures XML Schema XML Schema Determine 1 Determine “valid/invalid” Constraints choice Constraints 2 A B sequence sequence Generate Generate Test Intermediate Specification Instances 2 2 sequence sequence Generate Test Generate Specification Final Instances TAXI TAXI SE Day @ Rutgers 4/22/08 9
Identification of Types Mapping from CP to XPT Analyze preprocessor Specifications The CP categories in XPT Identify Sub- Identify Schema Sets Functional Units correspond to the Partition Identify Types occurrence and types of Categories Partition XML elements. Selecte Choices Values and Structures EX: String, sequence, all Determine Determine “valid/invalid” Constraints Constraints Generate Generate Test Intermediate Specification Instances Generate Test Generate Specification Final Instances TAXI TAXI SE Day @ Rutgers 4/22/08 10
Partition of Values and Structures Values of the elements: Mapping from CP to XPT Element attributes: fixed, default … Analyze preprocessor Specifications Restrictions: “minInclusive”, “maxInclusive”, “minExclusive”, “maxExclusive”, Identify Sub- Identify Schema Sets Functional Units “minLength”, “maxLength” Partition Identify Types Categories Information of the structure of Partition Selecte Choices Values and the final instances Structures Determine Determine Element: “minOccurs”, “maxOccurs” “valid/invalid” Constraints Constraints Attribute: “use” Generate Generate Test Intermediate Specification Instances Generate Test Generate Specification Final Instances TAXI TAXI SE Day @ Rutgers 4/22/08 11
Constraints of “valid/invalid” Two types of constraints can Mapping from CP to XPT be identified Analyze preprocessor Specifications Valid: values in choices conform Identify Sub- Identify Schema Sets Functional Units to the specification of the Partition Identify Types Categories XML Schema Partition Selecte Choices Values and Invalid: values in choices do Structures Determine not conform to the declaration Determine “valid/invalid” Constraints Constraints of XML Schema. Generate Generate Test Intermediate Specification Instances Generate Test Generate Specification Final Instances TAXI TAXI SE Day @ Rutgers 4/22/08 12
Example of “valid/invalid” contraints Sequence : The same sequence of element as the specification of XML Schema [Valid] The sequence of element is differnt from the XML Schema specification [Invalid] Numeric : Any digitals confrom to the specification of XML Schema [Valid] Any digitals do not conform to the specification of XML schema. [Invalid] String : Any strings confrom to the specification of XML Schema [Valid] Any strings do not conform to the specification of XML schema. [Invalid] Occurrence : Occurrence value ∈ (- ∞ , minOccurs) [Invalid] Occurrrence value ∈ [minOccurs, maxOccurs] [Valid] Occurrence value ∈ (maxOccurs, ∞ ) [Invalid] TAXI TAXI SE Day @ Rutgers 4/22/08 13
Intermediate Instances Generate intermediate instance by combining the values of “minOccurs” and “maxOccurs”. Mapping from CP to XPT We apply the conventional Boundary Condition test approach to reduce the combinations Analyze preprocessor Specifications Intermediate Instance Intermediate Instance Identify Sub- Identify sub-Schema Schema Sets Functional Units A A occurs=0 occurs=3 Partition Identify Types Categories B B occurs=2 occurs=2 minOccurs=0 Partition A Selecte Choices maxOccurs=3 Values and Structures Intermediate Instance Intermediate Instance Determine Determine “valid/invalid” Constraints Constraints minOccurs=2 A A occurs=0 occurs=3 B Generate maxOccurs=4 Generate Test Intermediate Specification Instances B B occurs=4 occurs=4 Generate Test Generate Specification Final Instances TAXI TAXI SE Day @ Rutgers 4/22/08 14
Instance Derivation The set of final instances Mapping from CP to XPT is generated by giving the Analyze preprocessor Specifications proper value to each Identify Sub- Identify Schema Sets Functional Units element. Partition Identify Types Categories The values are selected Partition Selecte Choices Values and from the choices according Structures Determine to the restrictions Determine “valid/invalid” Constraints Constraints expressed in the XML Generate Generate Test Intermediate Specification Schema. Instances Generate Test Generate Specification Final Instances TAXI TAXI SE Day @ Rutgers 4/22/08 15
Instance Derivation(2) The problem of CP method: Too many Mapping from CP to XPT generations! Analyze preprocessor Our solution: Specifications Apply Pair-wise testing during the Identify Sub- Identify Schema Sets Functional Units occurrence generation Partition Identify Types Categories Weighted Test Strategies Partition Selecte Choices Values and Structures Determine Determine “valid/invalid” Constraints Constraints Generate Generate Test Intermediate Specification Instances Generate Test Generate Specification Final Instances TAXI TAXI SE Day @ Rutgers 4/22/08 16
Main Interface of TAXI TAXI TAXI SE Day @ Rutgers 4/22/08 17
TAXI The mapping from the CP to the XML Schema Partition Testing has been partially implemented in a proof-of-concept tool called TAXI : Testing by Automatically generated XML Instances TAXI includes four components Schema Analyzer (XSA) Expands and preprocesses the XML Schema, Prepares the intermediate instance frames Provides a set of final instances Test Strategy Selector (TSS) Implements a set of test strategies. Manages the weight assignment for the elements in the identified functional units Values Storage (VS) Manages a database for occurrences and values assignment User Interface (UI) TAXI TAXI SE Day @ Rutgers 4/22/08 18
Recommend
More recommend