|
3 | 3 | <article version="5.0" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
4 | 4 | <info>
|
5 | 5 | <title>XQSuite - Annotation-based Test Framework for XQuery</title>
|
6 |
| - <date>3Q22</date> |
| 6 | + <date>1Q23</date> |
7 | 7 | <keywordset>
|
8 | 8 | <keyword>application-development</keyword>
|
9 | 9 | <keyword>testing</keyword>
|
|
158 | 158 | <code>%test:assertXPath($path-as-string)</code>
|
159 | 159 | </term>
|
160 | 160 | <listitem>
|
161 |
| - <para>Tests if the return value of the tested function using the given XPath expression.</para> |
162 |
| - <para>The annotation value is executed as an XPath expression. The assert passes if the XPath expression returns a non-empty sequence or a single atomic item whose effective boolean value is true. Within the XPath expression, the variable |
163 |
| - <code>$result</code> |
164 |
| - contains a reference to the result sequence returned by the tested function.</para> |
| 161 | + <para>Tests if the return value of the tested function using the given XPath expression. The annotation value is executed as an XPath expression. The assertion passes if the XPath expression returns a non-empty sequence or a single atomic item whose effective boolean value is true.</para> |
| 162 | + <itemizedlist> |
| 163 | + <listitem> |
| 164 | + <para>Within the XPath expression, you may refer to the sequence of items returned by |
| 165 | + the tested function using the variable <code>$result</code>. For example, if the |
| 166 | + result returns the element <code><x/></code>, you can test for this result with |
| 167 | + the annotation <code>%test:assertXPath("$result/self::x")</code>. If the result |
| 168 | + returns <code><x><y/></x></code>, the presence of the |
| 169 | + <code><y></code> element can be tested with the annotation expression |
| 170 | + <code>%test:assertXPath("$result/y")</code></para> |
| 171 | + </listitem> |
| 172 | + <listitem> |
| 173 | + <para>When selecting nodes with namespaces, use the namespace prefixes defined in the |
| 174 | + result sequence. For example, if the result returns an element <code><foo:x |
| 175 | + xmlns:foo="bar"/></code>, the annotation can test for this result with |
| 176 | + <code>%test:assertXPath("$result/self::foo:x")</code>.</para> |
| 177 | + </listitem> |
| 178 | + <listitem> |
| 179 | + <para>If the result contains node with a default namespace declaration, XQSuite |
| 180 | + assigns that namespace as the default element namespace for the annotation. For |
| 181 | + example, a result <code><x xmlns="foo"/></code> can be tested with the |
| 182 | + annotation <code>%test:assertXPath("$result/self::x")</code>.</para> |
| 183 | + </listitem> |
| 184 | + <listitem> |
| 185 | + <para>When selecting a result's descendant nodes that are assigned yet a different |
| 186 | + default namespace declaration, address these via namespace wildcard or "braced URI |
| 187 | + literal" notation. For example, the <code><y></code> element in the result |
| 188 | + <code><x xmlns="foo"><y xmlns="bar"/></x></code> can be tested |
| 189 | + with the annotation <code>%test:assertXPath("$result/*:y")</code> or |
| 190 | + <code>%test:assertXPath("$result/Q{bar}y")</code>.</para> |
| 191 | + </listitem> |
| 192 | + </itemizedlist> |
165 | 193 | </listitem>
|
166 | 194 | </varlistentry>
|
167 | 195 | <varlistentry>
|
|
0 commit comments