The 'Feature' attribute stores, roughly said, a text that is useful for recognition and is directly connected to the component itself. This can be either the text of the component (for example the label on a button), a programmatically assigned identifier or label of a component (for example CheckBox, RadioButton, TextField), a title ('Window', 'Dialog', 'TitledPanel'), or for a 'Web page' the URL.

Frequently, the value of the 'Feature' is identical to the 'Extra feature'qfs:label. This is because the label of the component is stored in qfs:label and this is often the text that is directly connected to the component. The redundancy still makes sense, since a status can be set for the extra feature: 'Ignore', 'Should match', or 'Must match'. The 'Feature' implicitly always has the status 'Should match'. For backwards compatibility reasons it cannot be replaced by qfs:label.

If no Name can be determined, the 'Feature' is used for generating the 'QF-Test component ID'. Examples for this can be found in How to judge robust component recognition.

Components can also be addressed directly in a SmartID via the 'Feature' without recording a 'Component' node.

Using regular expressions for working with dynamic window titles

Video The Video 'Component recognition' shows the use of regular expressions with window titles starting from minute 13:07.

In a lot of applications the developers do not use unique names and QF-Test keeps recording the same components again and again in different places. Playback with previously recorded components may still work, unless the window geometry changes significantly.

In this case it is very likely that the title of the main window changes frequently, for example to display a version string, a user name, a file name or some other variable information. If you want to keep your tests working and prevent recording multiple variants of this window and all its components, you have to select the respective 'Window' node and edit its 'Feature' attribute to replace the dynamic parts of the title with a regular expression. Be sure to check 'Use regexp'. Now your tests should work again.

Here you can see the use of a regular expression for a component of the CarConfigurator. Its 'Feature' attribute has to start with 'Edit' followed by an optional dynamic part:

Figure 5.8:  Using a regular expression in the 'Feature' attribute

QF-Test uses regular expressions in many places. You can find detailed information in section 47.3 to learn more about how to use them.

'Feature' for web components

For web components, the 'Feature' is determined according to the following logic:

  • HTML elements of class Frame or Document use the URL as 'Feature' attribute.
  • If none of the following special cases apply, the id attribute of the HTML element is used, if it exists and is sufficiently unique. Otherwise, the inner text of the HTML element, truncated if necessary, is used as 'Feature' attribute.
  • Special cases:
  • HTML tag name Value of the 'Feature' attribute
    TEXTText of the HTML element, truncated if necessary
    AText of the HTML element (truncated if necessary), otherwise the window title or the URL
    FIELDSETText of a contained HTML element with tag name "LEGEND"
    FORMValue of the "name" attribute
    IMGValue of the "alt" attribute, otherwise "src", otherwise part of the URL
    INPUTValue of the "name" attribute. For radio buttons with identical names, the value of the attribute "name" with the value of the "value" attribute appended
    BUTTONValue of the "name" attribute, otherwise text of the HTML element, truncated if necessary
    LABELText of the HTML element, truncated if necessary
    SELECTValue of the "name" attribute
    OPTIONIf the option OPT_WEB_USE_OPTION_LABEL is set, value of the "label" attribute, otherwise the text of the HTML element, truncated if necessary
    OPTGROUPValue of the "label" attribute
    IFRAMEValue of the "id" attribute, otherwise "name", otherwise "src"
    Table 5.1:  'Feature' attribute special cases for web components

In rare special cases, the 'Feature' attribute may also receive a value which is not described by the logic above.