![]()
This document provides information to implementers who wish to run the XQuery Test Suite on their implementation. It includes guidelines how test cases can be customized in order to run on an implementation, and describes the process of evaluating the results. The documentation of the XML Query Test Suite, which defines the structure of the test cases and the catalog, can be found in [1]. Guidelines for submitting results to the XML Query Working Group can be found in [3].
Ideally, the test harness produces an XML file
containing
all test results in the format shown below, that can be sent to the
working group.
In order to run the test suite on an XQuery implementation, implementers may customize the test suite and make a number of well-defined changes to the test cases. All changes made to the original test suite must be documented in free-text form as part of the result submission. Changes beyond the ones listed below must be highlighted.
XQuery supports a number of different ways to refer to source data as query context. Among these are implicit context, external variables, the fn:doc() function, the default collection function, implementation-defined functions, or parameter passing through host-language binding.
Test cases that do not refer to any input document (i.e., the catalog does not contain any “input-file” for the “test-case”) or test a specific context setting (i.e., a “context” attribute in the “input-file” element defines a specific context setting) may not be customized this way.
The following example is a customizable test
case (because the input-file element does not define a context
attribute)
| (: Name: Axes001 :) (: Description: Child Element :) (: insert-start :) declare variable $input-context external; (: insert-end :) $input-context/child |
and the corresponding
catalog
entry:
| <test-case name="Axes001"
FilePath="Axes" ... > ... <query name="Axes001.xq" date="2003-02-25"> <description>Child Element</description> </query> <input-file role="principal-data" variable="input-context">TreeCompass</input-file> <output-file role="principal" compare="XML">Axes001.xml</output-file> </test-case> |
The context setting for this test case may be customized in one of the following six ways. Note that option 3 and 5 (default) are only applicable for one source document.
| (: Name: Axes001 :) (: Description: Child Element :) $input-context/child |
| (: Name:
Axes001 :) (: Description: Child Element :) ./child |
| (: Name:
Axes001 :) (: Description: Child Element :) fn:doc("TreeCompass.xml")/child |
| (: Name:
Axes001 :) (: Description: Child Element :) fn:collection()/child |
| (: Name:
Axes001 :) (: Description: Child Element :) impl-fn:impl-udf("TreeCompass")/child |
When explicitly testing fn:doc and fn:collection
(including URI argument), test cases
must customize the URI used to resolve the input data specified in
the catalog. The same mechanism declaring an external variable
(referring to the URI value) as introduced in the previous section
is used. For example, a test case explicitly testing the
fn:doc()
function looks like:
| (: Name:
FnDoc001 :) (: Description: Test fn:doc() function :) (: insert-start :) declare variable $input-context external; (: insert-end :) $input-context/child |
Implementers may bind a URI value to the external variable, or remove the variable declaration. References to the external variable in the test case must be replaced with the fn:doc or fn:collection function as specified in the test case. The argument of the function must be either the external variable, or a constant URI value.
Test cases explicitly testing the implicit context, external variables or default collection must not contain an external variable declaration, and must not be customized.
Test cases can refer to validated documents (which requires namespace declaration) or imported schemas. Such test cases contain schema import declarations located within the same comments as the context item described above.
| (:
input-start :) import schema namespace example="http://www.example.com"; (: input-end :) |
This declaration must refer to a source schema document defined in the test suite catalog having the same name and URI.
| <schema
ID="example" type="schema" uri="http://www.example.com"
FileName="example.xsd"/> |
This declaration can be customized in one of the following three ways:
| declare namespace example="http://www.example.com"; |
Test cases can be embedded in a host language, for example using the xmlquery function in SQL. This may require escaping certain characters like quotes.
| select
xmlquery('$input-context/child' passing xmlcol as "input-context") from TreeCompass |
In order to check correctness of running a test case, the result of the implementation must be compared to the result provided in the test suite. The implementations result of the test case must be serialized and compared to the expected file(s) provided in the test suite. The catalog defines for each test case, which of the following five comparators has to be applied:
[1]
XQuery Test
Suite Documentation
[3] Guidelines for Submitting XQTS Results
Copyright © 1994-2005 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply. Your interactions with this site are in accordance with our public and Member privacy statements.