In this section:
Basic Data Bank Configuration
To configure a Data Bank tool:
- In the tool’s configuration page, click Add Extraction.
- Specify your extraction as follows:
Click in the XPath field and use the XPath builder to indicate which element you want to extract. For details, see Specifying XPaths.
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.
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}
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 outputVALUE
.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.
- Repeat the above process for each additional extraction you want to add. A single Data Bank can perform multiple extractions
- 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.
- In the tool’s configuration page, click Add Extraction.
- Choose a value type from the drop-down menu.
- Specify the name of the data source column in which to store the value.
- 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.
- 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>
Configuring a Data Generator
The Data Generator tool stores data, such as numbers, strings, and dates into data sources or test suite variables for use in other tools.For additional information, see Data Generator in the SOAtest/Virtualize documentation.
- Select a test or virtual asset and choose Add Data Generator from the action menu.
- (Optional) Specify a name for the tool.
- If you are adding a data generator to a test scenario, you can add requirements (see Associating Tests with Work Items).
- Click +Add Generator and choose a generator type from the drop-down menu. You can generate strings, numbers, and date/times.
- Specify the name of the data source column where the generated values will be stored in the Custom column field.
- Specify the generator options. Each type of generator has different options. See the following sections for details on configuring each type.
- Click Save to finish adding your tool.
Configuring String Generators
The following fields are used to configure how strings are generated.
Pattern
This field defines the structure of the string. The following special characters are used to define the pattern:
# | This character is replaced with a number 0-9 when the tool runs. |
& | This character is replaced with a character as defined in the character map. |
\ | Escapes the # and & characters, as well as other \ characters, so that they can be included in the generated string. |
Click on the information icon for a quick explanation of the characters.
If you want to implement dynamically generate a pattern, you can click the script icon in the Pattern field and choose a language from the drop-down menu.
Enter your script into the input field when prompted.
Choose Fixed from the Pattern drop-down menu to switch back to a static pattern.
Character Map
This field specifies how characters map to the pattern characters. The default value when set to fixed is all printable ASCII characters, 0x20 (space) through 0x7e (~).
Configuring Number Generators
The number generator enables you to randomly generate numbers between a minimum and maximum value, as well as set the number of decimal spaces. Negative numbers are supported.
Defaults
When the minimum, maximum, and decimal place values are set to Fixed and left blank, the following defaults are used:
Minimum | 0 |
---|---|
Maximum | 2147483647 |
Decimal places | 0 |
Additional Behaviors
The tool first generates a number that within the range specified in the Minimum and Maximum fields. Next, the number is rounded based on the number of decimal places specified.
You should enter a value in the Decimal places field equal to or greater than the largest number of decimal places specified in either the Maximum or Minimum values, otherwise the tool may generate a number outside the specified range when the number is rounded.
In the following example, the tool may generate a number outside the specified range:
Configuring Date/Time Generators
- Choose the start date from the Input source drop-down menu.
The following options are available:- Current date and time: Sets the start date and time to time of the test execution according to the local machine.
- Current date at midnight: Sets the start date and time to midnight (00:00:00) using the output time zone. If the output time zone is blank, the local machine time zone will be used.
User defined: Choose this setting to configure a specific start date, format, time zone, and locale.
The start date and format are required when User defined is enabled
If these settings are configured to use fixed values, but the fields are blank the date/time will not be generated. The following examples show different ways to specify the start date and format:
- Configure the output format, time zone, and locale.
- (Optional) Configure the tool to generate a past or future date in the Offset settings.
You can specify how far off the generated date and time should be from the start date and time. You can use negative numbers to use past dates.