Tests for free Fully Automatic Generator-Driven Tests of XSL Transformations Adam Duracz Walid Taha Halmstad University July 16, 2012
Motivation • XML • Popular to specify XML formats using XML Schema • XSL Transformations (XSLT) • Language for expressing transforms of XML docs • Complete XML Schema-based type checking of full XSLT is not possible * • Common to test XSLTs by hand-crafting input data • Expensive / error-prone / tedious * Alon et al 2001
Initial idea Since type checking of XSLTs isn’t possible, can we at least use generator-driven testing?
XSLT - Transformations from XML to XML S in S out XML Document XSLT XML Document • Common application areas • Systems integration , data migration, publishing • Often XML Schema for I/O formats are available • Tells us how valid input should look • Allows us to automatically validate output
Generator-driven test method S in S out T(d) d Generator T Validator
How XML Schema define XML documents <xsd:element name="people" <people> type="PeopleType"/> <person id="P001"> <name>Anna</name> <xsd:complexType <age>66</age> name="PeopleType"> </person> <xsd:sequence> <person id="P002"> <xsd:element <name>Jan</name> name="person" <age>35</age> type="PersonType" </person> minOccurs="2"/> </people> </xsd:sequence> </xsd:complexType>
How XML Schema define XML documents <xsd:element name="people" <people> type="PeopleType"/> <person id="P001"> <name>Anna</name> <xsd:complexType <age>66</age> name="PeopleType"> </person> <xsd:sequence> <person id="P002"> <xsd:element <name>Jan</name> name="person" <age>35</age> type="PersonType" </person> minOccurs="2"/> </people> </xsd:sequence> </xsd:complexType>
How XML Schema define XML documents <xsd:element name="people" <people> type="PeopleType"/> <person id="P001"> <name>Anna</name> <xsd:complexType <age>66</age> name="PeopleType"> </person> <xsd:sequence> <person id="P002"> <xsd:element <name>Jan</name> name="person" <age>35</age> type="PersonType" </person> minOccurs="2"/> </people> </xsd:sequence> </xsd:complexType>
How XML Schema define XML documents <xsd:element name="people" <people> type="PeopleType"/> <person id="P001"> <name>Anna</name> <xsd:complexType <age>66</age> name="PeopleType"> </person> <xsd:sequence> <person id="P002"> <xsd:element <name>Jan</name> name="person" <age>35</age> type="PersonType" </person> minOccurs="2"/> </people> </xsd:sequence> </xsd:complexType>
How XML Schema define XML documents <xsd:element name="people" <people> type="PeopleType"/> <person id="P001"> <name>Anna</name> <xsd:complexType <age>66</age> name="PeopleType"> </person> <xsd:sequence> <person id="P002"> <xsd:element <name>Jan</name> name="person" <age>35</age> type="PersonType" </person> minOccurs="2"/> </people> </xsd:sequence> </xsd:complexType>
Generator-driven test method S in S out T(d) d Generator T Validator
XML Schema Instance Generation <xsd:element name="family" <xsd:complexType> <xsd:sequence> <xsd:element name="person" type="..." minOccurs="2" <xsd:element name="pet" ...
Parsing Internal Repr. XML Schema <xsd:element Element name="family" <xsd:complexType> <xsd:sequence> <xsd:element name="person" type="..." minOccurs="2" <xsd:element name="pet" ...
Parsing Internal Repr. XML Schema <xsd:element Element name="family" <xsd:complexType> <xsd:sequence> ComplexType <xsd:element name="person" type="..." minOccurs="2" <xsd:element name="pet" ...
Parsing Internal Repr. XML Schema <xsd:element Element name="family" <xsd:complexType> <xsd:sequence> ComplexType <xsd:element name="person" Sequence type="..." minOccurs="2" <xsd:element name="pet" ...
Parsing Internal Repr. Internal Repr. XML Schema <xsd:element Element Element name="family" <xsd:complexType> <xsd:sequence> ComplexType ComplexType <xsd:element name="person" Sequence Sequence type="..." minOccurs="2" Element Element Element Element <xsd:element name="pet" ...
Generator construction Internal Repr. Generator genElement Element genComplexType ComplexType genSequence Sequence genElement genElement Element Element
Instance generation XML Schema Generator Schema instance <xsd:element ? genElement name="family" <xsd:complexType> <xsd:sequence> genComplexType <xsd:element name="person" genSequence type="..." minOccurs="2" genElement <xsd:element genElement name="pet" ...
Instance generation XML Schema Generator Schema instance <xsd:element genElement name="family" <xsd:complexType> <xsd:sequence> genComplexType <xsd:element name="person" genSequence type="..." minOccurs="2" genElement <xsd:element genElement name="pet" ...
Instance generation XML Schema Generator Schema instance <xsd:element <family> genElement name="family" <xsd:complexType> <xsd:sequence> genComplexType <xsd:element name="person" genSequence type="..." </family> minOccurs="2" genElement <xsd:element genElement name="pet" ...
Instance generation XML Schema Generator Schema instance <xsd:element <family> genElement name="family" <xsd:complexType> <xsd:sequence> genComplexType <xsd:element name="person" genSequence type="..." </family> minOccurs="2" genElement <xsd:element genElement name="pet" ...
Instance generation XML Schema Generator Schema instance <xsd:element <family> genElement name="family" <xsd:complexType> <xsd:sequence> genComplexType <xsd:element name="person" genSequence type="..." </family> minOccurs="2" genElement <xsd:element genElement name="pet" ...
Instance generation XML Schema Generator Schema instance <xsd:element <family> genElement name="family" <xsd:complexType> <xsd:sequence> genComplexType <xsd:element name="person" genSequence type="..." </family> minOccurs="2" genElement <xsd:element genElement name="pet" ...
Instance generation XML Schema Generator Schema instance <xsd:element <family> genElement name="family" <person name="Anna"/> <xsd:complexType> <person name="Jan"/> <xsd:sequence> genComplexType <xsd:element name="person" genSequence type="..." </family> minOccurs="2" genElement <xsd:element genElement name="pet" ...
Instance generation XML Schema Generator Schema instance <xsd:element <family> genElement name="family" <person name="Anna"/> <xsd:complexType> <person name="Jan"/> <xsd:sequence> genComplexType <xsd:element name="person" genSequence type="..." </family> minOccurs="2" genElement <xsd:element genElement name="pet" ...
Instance generation XML Schema Generator Schema instance <xsd:element <family> genElement name="family" <person name="Anna"/> <xsd:complexType> <person name="Jan"/> <xsd:sequence> genComplexType <pet <xsd:element name="Moxy" name="person" genSequence species="rabbit"/> type="..." </family> minOccurs="2" genElement <xsd:element genElement name="pet" ...
Recommend
More recommend