The This topic explains how to configure and apply the Text Data Bank tool extracts tool in SOAtest and Virtualize. This tool extract values from any text content , (including plain text, HTML, XML, etc., ) and makes the those values available as parameters in other tools and configurations.
...
The Text Data Bank can extract values from any text content (including plain text, HTML, XML, etc.) . You can specify by specifying left-hand and right-hand boundaries that mark the beginning and end of the extracted text. Characters between the values specified in the left- and right-hand fields will define the value to be extracted. It is useful when you want to extract plain text (e.g., for use in another tool or configuration panel), and cannot use other extraction tools such as the Browser Data Bank, XML Data Bank, JSON Data Bank, and so forth. The Text Data Bank tool is typically configured as an output of another tool (most commonly, a Browser Playback or Message Responder tool) that delivers text output. In this case, the Text Data Bank’s Text Content area will be populated with the text output of the chained tool after tool execution completes. Alternatively, you can create a "standalone" tool using the Text Data Bank tool, then specify a file that contains the desired text content (for instance, a log file or other file that is dynamically updated or created during every tool run).
...
Info | ||
---|---|---|
| ||
The Text Data Bank operates only on content considered to have a text MIME Type. A MIME Type is based on the specified ContentType or by the file extension. You can control which what what MIME Types are considered to be "text" by opening Parasoft> Preferences> MIME Types and and selecting the "Text" option for the appropriate MIME Types. |
...
Configuring Text Data Bank
To configure a Text Data Bank
...
tool to extract text during a tool run:
- Add the tool as an output of a tool that provides text output—or add it as a standalone tool (if you want to extract Right-click on a tool and choose Add Output... You can also right-click on the scenario folder and choose Add New > Test... to add a standalone instance of the tool. A standalone instance enables you to extract data from a file that is being dynamically updated or created for every tool run).
- Choose a traffic source type in the left-side panel. For example, if you want to extract a part of the response header, choose Response > Transport Header in SOAtest or Outgoing Response > Payload in Virtualize.
- Choose Text Data Bank and click Finish.
The data bank will be attached to the test or added to the suite. See Configuring the Text Data Bank Tool for next steps.
Configuring the Text Data Bank
If you added the tool as an output of an existing tool, configure the fields under Tool Settings to extract text data. Standalone instances of the tool will have an Input tab for specifying the source from which you to extract content, as well as a Tool Settings tab for configuring extractions.
Tool Settings
- Enter the source content from which you want to extract into the Text Content field. If you added the Text Data Bank as an output, you can run the parent tool to populate the field. If you added the tool as a standalone tool, click on the Input tab to specify the file from which you want to extract content.
- Select the text inside the Text Content field that you want to extract and click Create Extraction from Selection. You can also click Add to manually add and configure an extraction. See Configuring Extractions for details about manually configuring extraction settings.
- You can change the default description (optional) and click OK to continue.
...
In the tool configuration panel, go to the Text Content area and select the area of text that you want to extract.
Info title This specific value may not always be extracted Note that if this value changes during subsequent tool runs, this
...
specific value may not always be extracted.
...
Whatever value appears in this location will be extracted, instead. A new extraction will occur each time this tool is run.
You can also define extractions manually by clicking the Add button and specifying extraction details.
- Click Create Extraction.
- Specify the name of the column you want to contain the extracted data.
The extraction will be added to the table, and can be modified or removed using the available controls
Configuring Extractions
- Select the extraction and click Modify to open the tool configuration overlay.
- Enter a description for the extraction in the Description field. The description is for identification purposes only and does not need to be unique.
- Specify a name for the column holding the data being extracted in the Column Name field. The column refers to the fields in the Data Source Column Name column of the extractions table. Column names should be unique. Extractions with the same column name will be overwritten in order from first to last row in the extractions table.
- Specify the start of the extraction in the Left-hand text field and the end of the extraction in the Right-hand text field. Characters that appear between the patterns specified in these fields will be extracted from the Text Content field. You can enable the Regular expression options for each field to programmatically specify the patterns. Using regular expressions enables the tool to correctly extract characters if the Text Content field changed, set end-of-line characters, etc. In the following example, the end of the extraction is marked with a regular expression that matches a carriage return or semicolon.
- If the extracted text is to be used for a URL, choose URL Encoded from the Extract Option menu.
- Click OK to save your changes.
Options
Enable the Remove tabs and newline characters before processing option to normalize whitespace in extracted text. This option is enabled by default.