Test Space XML Schema

From STRIDE Wiki
Revision as of 20:19, 5 June 2014 by Ivailop (talk | contribs) (→‎Test Space XSD)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Example of Minimal XML to be Uploaded

The following shows a more-or-less minimum required xml document that can be uploaded to Test Space.

Additional test_suite and test_case attributes can be added as desired.

<?xml version="1.0" encoding="UTF-8" ?>
<reporter product_version="external" schema_version="1.0">
  <test_suite name="MyTestSuite" start_time="0">
      <test_case name="MyTest" status="passed">
	  </test_case>
      <test_case name="MyTest1" status="failed">
	  </test_case>
  </test_suite>
</reporter>

Test Space XSD

The following xsd describes the schema accepted by the Test Space uploader.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:complexType name="commentType">
    <xs:simpleContent>
        <xs:extension base="xs:string">
            <xs:attribute name="label" type="xs:string" use="required" />
            <xs:attribute name="priority">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="low"/>
                        <xs:enumeration value="normal"/>
                        <xs:enumeration value="high"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
        </xs:extension>
    </xs:simpleContent>
</xs:complexType>

<xs:complexType name="customdataType">
    <xs:simpleContent>
        <xs:extension base="xs:string">
            <xs:attribute name="name" type="xs:string" use="required" />
        </xs:extension>
    </xs:simpleContent>
</xs:complexType>

<xs:complexType name="annotationType" mixed="true">
    <xs:sequence minOccurs="0" maxOccurs="unbounded">
        <xs:element name="comment" type="commentType"/>
    </xs:sequence>
    <xs:attribute name="name" type="xs:string" use="required" />
    <xs:attribute name="description" type="xs:string"/>
    <xs:attribute name="file" type="xs:string"/>
    <xs:attribute name="level" use="required">
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="trace"/>
                <xs:enumeration value="debug"/>
                <xs:enumeration value="info"/>
                <xs:enumeration value="warn"/>
                <xs:enumeration value="error"/>
                <xs:enumeration value="fatal"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="link_file" type="xs:boolean"/>
    <xs:attribute name="file_name" type="xs:string"/>
    <xs:attribute name="default_file_name" type="xs:boolean"/>
    <xs:attribute name="mime_type" type="xs:string"/>
</xs:complexType>

<xs:complexType name="testcaseType">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="comment" type="commentType"/>
        <xs:element name="custom_data" type="customdataType"/>
        <xs:element name="annotation" type="annotationType"/>
    </xs:choice>
    <xs:attribute name="name" type="xs:string" use="required" />
    <xs:attribute name="description" type="xs:string"/>
    <xs:attribute name="start_time" type="xs:string" use="required" />
    <xs:attribute name="status" use="required">
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="passed"/>
                <xs:enumeration value="failed"/>
                <xs:enumeration value="unknown"/>
                <xs:enumeration value="in_progress"/>
                <xs:enumeration value="not_applicable"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="explicit_duration" type="xs:boolean" />
    <xs:attribute name="duration" type="xs:float"/>
    <xs:attribute name="metric" type="xs:decimal" />
    <xs:attribute name="metric_units" type="xs:string"/>
</xs:complexType>

<xs:complexType name="testsuiteType">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="test_case" type="testcaseType"/>
        <xs:element name="test_suite" type="testsuiteType"/>
        <xs:element name="custom_data" type="customdataType"/>
        <xs:element name="annotation" type="annotationType"/>
    </xs:choice>
    <xs:attribute name="name" type="xs:string" use="required" />
    <xs:attribute name="description" type="xs:string" />
    <xs:attribute name="start_time" type="xs:string" use="required" />
    <xs:attribute name="linked" type="xs:boolean" />
    <xs:attribute name="links_to" type="xs:string" />
    <xs:attribute name="unknown" type="xs:unsignedInt" />
    <xs:attribute name="in_progress" type="xs:unsignedInt" />
    <xs:attribute name="passed" type="xs:unsignedInt" />
    <xs:attribute name="failed" type="xs:unsignedInt" />
    <xs:attribute name="not_applicable" type="xs:unsignedInt" />
</xs:complexType>

<xs:element name="reporter">
    <xs:complexType>
        <xs:choice minOccurs="1" maxOccurs="unbounded">
            <xs:element name="test_suite" type="testsuiteType"/>
            <xs:element name="annotation" type="annotationType"/>
        </xs:choice>
        <xs:attribute name="product_version" type="xs:string"/>
        <xs:attribute name="schema_version" type="xs:string"/>
    </xs:complexType>
</xs:element>

</xs:schema>