Testing XQuery Transformations

XQuery maps can describe XML-to-XML, XML to non-XML, and non-XML to XML mappings. An XQuery transformation can take multiple inputs and returns one output. Each input corresponds to an XQuery external variable declared in the XQuery resource. The value of an XQuery input variable can be a primitive value (String, integer, date, and so on), an XML document, or a sequence of these types. The output value can be a primitive value (String, integer, date, and so on), an XML document, or a sequence of these types.

Note: The test console does not support sequences on input.

Table 30-7 describes XQuery configuration options.

Table 30-7 Configuring XQuery Options 
Section
Description
Name
The name of the resource being tested.
Test Console Actions
Execute
Execute the transformation.
Reset
Reset the input field(s).
Close
Close the test console.
Variables
This section contains one input field for each of the XQuery external variables.
<param_name> ([] as XML)
param_name is a XQuery variable name in the XQuery resource.
In the test console, a single-line edit box is displayed if the type is a simple type. A multi-line edit box is displayed if the data is XML.
A combination input (<param_name> ([] as XML)) is used when the variable is not typed. You must declare the variable type. Select the check box to identify a parameter of type XML.
An XML input can be file-based or text-based. Referencing a file for input takes precedence over textual input. Browse and select the file you want to use in your test.
Input in the test console is rendered based on the type to make it easier to understand the type of data you must enter. When untyped, the default type is XML.

You can test the design time or the run time.

  1. Click Activate if you want to test the run time. Do not activate the session to test the design time.
  2. Select Project Explorer > XQueries to display the Summary of XQueries page.
  3. Under Actions, click the Launch Test Console icon associated with the resource you want to test. The test console opens the Resource Testing page.
  4. Configure the test data for the resource in the Variables section of the page. For more information, see Table 30-7.
  5. Click Execute. The Resource Testing page displays the results.
  6. To retest, click Back. You can close the test console, modify, and retest the resource.