Test Space XML Schema: Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
(Created page with '==Test Space XSD== The following xsd describes the schema accepted by the Test Space uploader. <pre> <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.or…')
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
==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.
<pre>
<?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>
</pre>
==Test Space XSD==
==Test Space XSD==
The following xsd describes the schema accepted by the Test Space uploader.
The following xsd describes the schema accepted by the Test Space uploader.
Line 4: Line 21:
<pre>
<pre>
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="reporter">
 
    <xs:complexType>
<xs:complexType name="commentType">
      <xs:sequence>
     <xs:simpleContent>
        <xs:element maxOccurs="unbounded" ref="test_suite"/>
         <xs:extension base="xs:string">
      </xs:sequence>
            <xs:attribute name="label" type="xs:string" use="required" />
      <xs:attribute name="product_version" use="required" type="xs:NMTOKEN"/>
            <xs:attribute name="priority">
      <xs:attribute name="schema_version" use="required" type="xs:decimal"/>
                <xs:simpleType>
    </xs:complexType>
                    <xs:restriction base="xs:string">
  </xs:element>
                        <xs:enumeration value="low"/>
  <xs:element name="test_suite">
                        <xs:enumeration value="normal"/>
     <xs:complexType>
                        <xs:enumeration value="high"/>
      <xs:sequence>
                    </xs:restriction>
         <xs:element minOccurs="0" maxOccurs="unbounded" ref="test_suite"/>
                </xs:simpleType>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="test_case"/>
            </xs:attribute>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="annotation"/>
        </xs:extension>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="custom_data"/>
    </xs:simpleContent>
      </xs:sequence>
</xs:complexType>
      <xs:attribute name="description" use="optional"/>
 
      <xs:attribute name="failed" use="required" type="xs:integer"/>
<xs:complexType name="customdataType">
      <xs:attribute name="in_progress" use="required" type="xs:integer"/>
     <xs:simpleContent>
      <xs:attribute name="linked" use="required" type="xs:boolean"/>
      <xs:attribute name="name" use="required" type="xs:NCName"/>
      <xs:attribute name="not_applicable" use="required" type="xs:integer"/>
      <xs:attribute name="passed" use="required" type="xs:integer"/>
      <xs:attribute name="start_time" use="required" type="xs:dateTime"/>
      <xs:attribute name="unknown" use="required" type="xs:integer"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="test_case">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="annotation"/>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="custom_data"/>
      </xs:sequence>
      <xs:attribute name="description" use="optional"/>
      <xs:attribute name="duration" use="required" type="xs:decimal"/>
      <xs:attribute name="explicit_duration" use="required" type="xs:boolean"/>
      <xs:attribute name="metric" use="required" type="xs:decimal"/>
      <xs:attribute name="metric_units" use="required"/>
      <xs:attribute name="name" use="required" type="xs:NCName"/>
      <xs:attribute name="start_time" use="required" type="xs:dateTime"/>
      <xs:attribute name="status" use="required" type="xs:NCName"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="custom_data">
     <xs:complexType>
      <xs:simpleContent>
         <xs:extension base="xs:string">
         <xs:extension base="xs:string">
          <xs:attribute name="name" use="required" type="xs:NCName"/>
            <xs:attribute name="name" type="xs:string" use="required" />
         </xs:extension>
         </xs:extension>
      </xs:simpleContent>
    </xs:simpleContent>
     </xs:complexType>
</xs:complexType>
  </xs:element>
 
  <xs:element name="annotation">
<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:complexType>
      <xs:sequence>
         <xs:choice minOccurs="1" maxOccurs="unbounded">
         <xs:element minOccurs="0" maxOccurs="unbounded" ref="comment"/>
            <xs:element name="test_suite" type="testsuiteType"/>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="custom_data"/>
            <xs:element name="annotation" type="annotationType"/>
      </xs:sequence>
        </xs:choice>
      <xs:attribute name="default_file_name" use="required" type="xs:boolean"/>
        <xs:attribute name="product_version" type="xs:string"/>
      <xs:attribute name="description" use="optional"/>
        <xs:attribute name="schema_version" type="xs:string"/>
      <xs:attribute name="file" use="required"/>
      <xs:attribute name="file_name" use="required"/>
      <xs:attribute name="level" use="required" type="xs:NCName"/>
      <xs:attribute name="link_file" use="required" type="xs:boolean"/>
      <xs:attribute name="mime_type" use="required"/>
      <xs:attribute name="name" use="required" type="xs:NCName"/>
     </xs:complexType>
     </xs:complexType>
  </xs:element>
</xs:element>
  <xs:element name="comment">
 
    <xs:complexType mixed="true">
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="custom_data"/>
      </xs:sequence>
      <xs:attribute name="label" use="required" type="xs:NCName"/>
      <xs:attribute name="priority" use="required" type="xs:NCName"/>
    </xs:complexType>
  </xs:element>
</xs:schema>
</xs:schema>
</pre>
</pre>

Latest revision as of 20:19, 5 June 2014

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>