source: resources/apps/xforms-test-suite/suite.rnc @ aab39dd

Revision aab39dd, 2.9 KB checked in by Eric van der Vlist <vdv@dyomedea.com>, 7 years ago (diff)

Refactoring the test suite vocabulary and adding a schema

  • Property mode set to 100644
Line 
1# Relax NG schema generated from an Examplotron schema.
2#
3# Version of the compiler: "0.8"
4#
5# About Examplotron: http://examplotron.org
6# Bug reports: vdv@dyomedea.com
7# SVN: http://svn.xmlschemata.org/repository/downloads/examplotron/
8#
9
10default namespace = "http://xformsunit.org/namespaces/model/"
11namespace ega = "http://examplotron.org/annotations/"
12namespace ns1 = "http://xformsunit.org/namespaces/view/"
13namespace ns2 = "http://xformsunit.org/namespaces/suite/"
14namespace ns3 = "http://xformsunit.org/namespaces/controller/"
15namespace sch = "http://www.ascc.net/xml/schematron"
16
17start =
18  element ns2:suite {
19    # Reference to the form to test
20   
21    # The test cases
22    element ns2:form {
23      [ ega:example [ src = "hello-world.xhtml" ] ]
24      attribute src { text }?
25    },
26    element ns2:case {
27      # Title
28     
29      # Set a value (similar to XForms' setvalue action)
30     
31      # Check that an instance node is equal to its expected value
32     
33      # Check if a control is enabled
34      [ ega:example [ id = "test-greetings" ] ] attribute id { text }?
35      & element ns2:title {
36          [
37            ega:example [
38              "Test that the greetings are displayed and enabled."
39            ]
40          ]
41          text
42        }
43      & element ns3:setvalue {
44          [
45            ega:example [ ref = "instance('instance')/PersonGivenName" ]
46          ]
47          attribute ref { text }?,
48          [ ega:example [ "Eric" ] ] text
49        }*
50      & element assertEqual {
51          # Actual value
52         
53          # Expected
54         
55          # Message to display when the test fails
56          element actual {
57            [ ega:example [ ref = "instance('instance')/Greetings" ] ]
58            attribute ref { text }?
59          },
60          element expected {
61            [ ega:example [ "Hello Eric. We hope you like XForms!" ] ]
62            text
63          },
64          element message {
65            [
66              ega:example [
67                'The greetings should be the concatenation of "Hello ", the given name and ". We hope you like\x{a}' ~
68                '                XForms!".'
69              ]
70            ]
71            text
72          }
73        }*
74      & element ns1:assertEnabled {
75          # Identification of the control. Being an element leaves more flexibility to use other means than id/idref
76         
77          # Expected value (boolean)
78         
79          # Message to display if the test fails
80          element ns1:control {
81            [ ega:example [ idref = "greetings-control" ] ]
82            attribute idref { text }?
83          },
84          element ns1:expected {
85            [ ega:example [ "true" ] ] xsd:boolean
86          },
87          element ns1:message {
88            [
89              ega:example [
90                "The greetings control should be enabled at that point."
91              ]
92            ]
93            text
94          }
95        }*
96    }*
97  }
Note: See TracBrowser for help on using the repository browser.