[elbe-devel] [PATCH v2 1/5] Add XML schema definition for Junit test suites/cases.

dion at linutronix.de dion at linutronix.de
Wed Aug 7 16:34:39 CEST 2019


From: Olivier Dion <dion at linutronix.de>

It's now possible to execute test suites and generate a compatible
JUnit XML file for a project.

* <unit-tests>

  The <unit-tests> node is an _unique_ children to the <target> node
  and accepts an unbounded sequence off <test-suite> nodes.

  If a <unit-tests> node is provided, then a "elbe-junit.xml" file is
  created for the project.

* <test-suite>

  The <test-suite> nodes are children to the <unit-tests> node.  They
  accept an unbounded sequence of nodes of _type_ <test-case>.

  Is has a mandatory attribute 'name' which is an human readable
  identifier for the suite.

* <test-case>

  The <test-case> nodes are children of a <test-suite> node.  They
  _are not identified_ by the <test-case> tag.  This is because
  <test-case> is actually a group type and thus the actual tag has to
  be within the group's choices.

  As for now, only the <file-exists> node is a valid choice.

** <file-exists>

   The <file-exists> node is a choice of the <test-case> group.  It
   verifies that a file exists in the target filesystem.

* Example

  My project's XML file:
  --------------------------------------------------------------------
  ...
  <target>
    ...
    <project-finetuning>
      <unit-tests>

        <test-suite name="Suite A">
	  <file-exists>/etc/fstab></file-exists>
	  <file-exists>/bin/clang</file-exists>
	</test-suite>

	<test-suite name="Suite B">
	  <file-exists>/home/notroot</file-exists>
	</test-suite>

      </unit-tests>
    </project-finetuning>
    ...
  </target>
  ...
  --------------------------------------------------------------------

Signed-off-by: Olivier Dion <dion at linutronix.de>

squash! Add XML schema definition for Junit test suites/cases.
---
 schema/dbsfed.xsd | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/schema/dbsfed.xsd b/schema/dbsfed.xsd
index fbed8e98..7fbd7396 100644
--- a/schema/dbsfed.xsd
+++ b/schema/dbsfed.xsd
@@ -1940,6 +1940,13 @@
           </documentation>
         </annotation>
       </element>
+      <element name="unit-tests" type="rfs:unit-tests" minOccurs="0" maxOccurs="1">
+        <annotation>
+          <documentation>
+	    Allows to generate test suites for the project.
+          </documentation>
+        </annotation>
+      </element>
     </choice>
   </group>
 
@@ -2431,4 +2438,50 @@
     </simpleContent>
   </complexType>
 
+  <complexType name="unit-tests">
+    <annotation>
+      <documentation>
+	Sequence of test suites.  The require attribute 'dst' is the
+	name of the file where the Junit XML file will be dump
+	relative to the project directory.
+      </documentation>
+    </annotation>
+    <sequence>
+      <element name="test-suite" type="rfs:test-suite" minOccurs="0" maxOccurs="unbounded">
+      </element>
+    </sequence>
+  </complexType>
+
+  <complexType name="test-suite">
+    <annotation>
+      <documentation>
+	A test suite is a sequence of test cases.  The required
+	attribute name is the an human readable identifier for the
+	test suite.
+      </documentation>
+    </annotation>
+    <sequence>
+      <group ref="rfs:test-case" minOccurs="0" maxOccurs="unbounded" >
+      </group>
+    </sequence>
+    <attribute name="name" type="string" use="required" />
+  </complexType>
+
+  <group name="test-case">
+    <annotation>
+      <documentation>
+	A test-case is a choice of a test to make on the target fs.
+      </documentation>
+    </annotation>
+    <choice>
+      <element name="file-exists" type="rfs:string" minOccurs="0">
+	<annotation>
+          <documentation>
+	    Verify that a file exists.
+          </documentation>
+        </annotation>
+      </element>
+    </choice>
+  </group>
+
 </schema>
-- 
2.11.0




More information about the elbe-devel mailing list