Page tree

Skip to end of metadata
Go to start of metadata

You can use Data Bank tools to extract values from an incoming request so it can be used to populate an element of the associated response.

In this section:

Configuring JSON and XML Data Bank Tools

  1. In the tool’s configuration page, click Add Extraction.
  2. Specify your extraction as follows:
    1. Click in the XPath field and use the XPath builder to indicate which element you want to extract. For details, see Specifying XPaths.

    2. Leave Extract to set to Custom column. Note that if you are editing a Data Bank tool that was created in SOAtest Desktop, additional options (Writable data source column, Suite variable) may be shown; you can use CTP to change from your existing setting to Custom column

    3. Under Column name, specify the name of the "Custom Column" to which you want the value extracted. This will be used to reference the extracted value throughout the test scenario. For example, assume you extract into a custom column named systemID:

      You could later reference that extracted value using ${systemID}
       

       

    4. Indicate whether you want to extract the text content, the entire element, or all child nodes.

      Extraction Options

      Text content extracts the text content of the selected element. For example, XPath/Parent will output VALUE.

      Entire element extracts the entire XPath. For example, XPath/Parent will output <parent>VALUE</parent>. You can configure Index to extract, which controls which element is extracted if the element occurs more than once.

      All child nodes extracts all child nodes of the element selected.

  3. Repeat the above process for each additional extraction you want to add. A single Data Bank can perform multiple extractions
  4. Review and modify tool options as needed. Available options include:
    • Canonicalize XML output (for XML Data Banks only): Specifies whether extracted elements are canonicalized. It applies only if an entire element is extracted. If this is enabled and the extracted element contains prefixes referencing namespaces that are not declared in the same element, then any necessary namespace declarations will be added to the extracted element.
    • Allow alteration: If you want to configure XPath alterations (i.e., appending, prepending, or replacing values), open this tool in SOAtest desktop and use the Allow alteration controls in that UI. 
    • Extract empty elements as: Specifies whether empty elements will be extracted. It applies when the extracted element is an empty string. When this option is enabled, you can use the adjacent text field to specify a text string that indicates what "placeholder" value should be added for every empty extracted element. 
    • Extract missing elements as: Specifies whether missing elements will be extracted. It applies when the extraction fails to locate any matching nodes.When this option is enabled, you can use the adjacent text field to specify a text string that indicates what "placeholder" value should be added for every empty extracted element. 
    • Save expected saves the message received by the associated test client. This message is used by the XPath builder.

Configuring a REST URL Data Bank

URL Data Bank only applies to Service Virtualization and requires Parasoft Virtualize 9.10.2 or higher. This tool enables you to extract the following values from a REST URL and store them in a data bank:

  • Host
  • Port
  • HTTP Method
  • Path (by index)
  • Parameter (by name)

You can extract parameters that occur multiple times by concatenating the values. This tool is only available in CTP for message responders.

  1. In the tool’s configuration page, click Add Extraction.
  2. Choose a value type from the drop-down menu.
     
  3. Specify the name of the data source column in which to store the value. 
  4. Add additional extractions for the URL values you want to extract. You can only extract one host, port, and method, but you can add several path and parameter values to extract complex URLs.
  5. Specify any additional tool options and click Save.

Tool Options

The following options can also be configured:

  • Extract empty elements as: Specifies whether or not empty elements will be extracted. When this option is enabled, you can use the adjacent text field to specify a text string that indicates what "placeholder" value should be added for every empty extracted element.
  • Extract missing elements as: Specifies whether or not missing elements will be extracted. When this option is enabled, you can use the adjacent text field to specify a text string that indicates what "placeholder" value should be added for every missing extracted element.
  • You can specify a position in the URL path to extract in the Request template field:

(<method>)  <host>:<port>/<path 0>/<path 1>/<path . . .>/<parameter>

 

 

  • No labels