The Create Property Based on Surrounding Values filter lets you read textual content and filter it for information to be stored in DevTest properties. The filter can be used on text, and on XML and HTML treated as text. The filter uses a "paint the screen" technique.
"Paint the screen" gives you great flexibility to define what in the HTML you want to parse as properties. Mark the text in one of the following ways:
The text is marked using the icons at the bottom of the editor.
In the following example, the goal is to store the size of a specific file in a property.
The text is marked using the editor icons, by selecting the text, and then clicking the appropriate icon.
Note: Property blocks must always be bounded by Must blocks.
This screen shows the contents of the text buffer. The goal is to parse the file size of the _misc-reporting.jar file. The file size is the number that appears after _misc-reporting.jar.
The boundaries are set around the file size, and Must has been clicked. The actual file size text inside the selected content was selected, and Property was clicked.
The property name was then entered into the dialog. The actual value of the file size has been replaced with the name of the property.
When this filter is run, the property filesize is assigned the size of the _misc-reporting.jar file.
You can repeat this process on this text buffer to define as many properties as necessary.
Handling Nonunique Tokens
If you see the following error message, your selected token is not unique; the selection you made is repeated in the token before it.
To solve this issue in most cases, simply create another token to make the prior token a Must token also. In other cases, when this technique does not work, a judicious placement of another Must block between the two duplicate tokens avoids the error.
This solution works because DevTest can distinguish between the two duplicate tokens, which are based on their relative location.
Copyright © 2014 CA Technologies.
All rights reserved.
|
|