42.10
Queries

Automating a GUI test gets difficult whenever the SUT shows dynamic or unpredictable behavior, i.e. when it displays values that change with every run of the program. This is typically the case for fields that are filled automatically with things like the current time, an automatic ID from a database, etc.

QF-Test addresses this issue with means to read values from the SUT's components or to determine the numerical index of a sub-item when given its name. These values are stored in variables to be used again later as the test proceeds.

42.10.1
Fetch text

This node lets you read a value from the SUT during the execution of a test run. The text is assigned to the local or global variable (see chapter 6) named by the Variable name attribute. To avoid negative side effects, the variable content will not be auto-expanded when being read.

Not all components display text and some complex components contain multiple textual items, so this operation is only supported for certain components or sub-items. If you try to fetch the text from the wrong component, an OperationNotSupportedException is thrown, while an unsupported sub-item leads to an UnexpectedIndexException. The following table lists the supported component and sub-item targets for this operation. (P/S) means primary/secondary index.

Web In web applications every node could contain some text, so QF-Test returns either the text or an empty value, but never throws an OperationNotSupportedException.

Class Index (P/S) Result
AbstractButton -/- getText()
Dialog -/- getTitle()
Frame -/- getTitle()
ComboBox -/- Current value (use renderer)
ComboBox List item/- List item (use renderer)
JEditorPane Character index/- Structural element at index (experimental)
Label -/- getText()
List Item/- Item (use renderer)
TabbedPane Tab/- Title of tab
Table Column/Row Cell contents (use renderer)
JTableHeader Column/- Column title (use renderer)
TextArea Line number/- Line of text
JTextComponent -/- getText()
Tree Node/- Node (use renderer)
Label -/- getText()
TextField -/- getText()
Table 42.25:  Components supported by Fetch text

Contained in: All kinds of sequences.

Children: None

Execution: The data of the target component is sent to the SUT. The TestEventQueue determines the corresponding component, retrieves the requested value and sends it back to QF-Test, where it is stored in a global variable.

Attributes:

Fetch text attributes
Figure 42.68:  Fetch text attributes
Client

The name of the SUT client process from which to query the data.

Variable: Yes

Restrictions: Must not be empty.

QF-Test component ID

The QF-Test ID of the Window, Component or Item node that is to be queried.

The "Select component" button [Select component] brings up a dialog in which you can select the component interactively. You can also get to this dialog by pressing Shift⁠+⁠Return or Alt⁠+⁠Return, when the focus is in the text field. As an alternative you can copy the target node with Ctrl⁠+⁠C or »Edit«-»Copy« and insert its QF-Test component ID into the text field by pressing Ctrl⁠+⁠V.

This attribute supports a special format for referencing components in other test suites (see section 26.1). Furthermore, sub-elements of nodes can be addressed directly without requiring separate nodes for them (see section 5.9). When using SmartIDs, you can address a GUI element directly via its recognition criteria. For more information, refer to SmartID and Component nodes versus SmartID.

Variable: Yes

Restrictions: Must not be empty.

Variable name

The name of the global variable to which the result of the query is assigned (see chapter 6).

Variable: Yes

Restrictions: Must not be empty.

Local variable

This flag determines whether to create a local or global variable binding. If unset, the variable is bound in the global variables. If set, the topmost current binding for the variable is replaced with the new value, provided this binding is within the context of the currently executing Procedure, Dependency or Test case node. If no such binding exists, a new binding is created in the currently executing Procedure, Dependency or Test case node or, if there is no such node in the topmost node on the variables stack, falling back to the global bindings if necessary. See chapter 6 for a detailed explanation of variable binding and lookup.

In order to predefine the option use Enable 'Local variable' attribute by default.

Variable: No

Restrictions: None

QF-Test ID

At the moment the QF-Test ID attribute has no meaning for this type of node.

Variable: No

Restrictions: Must not contain any of the characters '\', '#', '$', '@', '&', or '%' or start with an underscore ('_').

Delay before/after

These attributes cause a delay before or after the execution of the node. If a value is empty, the Default delay from the global options is used.

Variable: Yes

Restrictions: Valid number >= 0

Comment

Here you can enter a comment that explains the purpose of this node. This is the preferred way of documenting the test suite.

Note For detailed documentation, especially for Test set, Test case or Procedure nodes, this text area might not be the right place. There are many excellent editors that are much better suited to this task. The option External editor command lets you define an external editor in which comments can be edited conveniently by pressing Alt⁠+⁠Return or by clicking the External editor button.

You can trigger special behaviors of some nodes using doctags, please see Doctags.

If you enter text in the comment field of a Component node, the node will be considered as 'used' when you want to mark or delete unused components.

Variable: Yes

Restrictions: None

42.10.2
Fetch index

With the help of this node you can determine the index of a sub-item during the execution of a test, provided its displayed text is known. Obviously only an Item is supported as the target component. The result is assigned to the local or global variable (see chapter 6) named by the Variable name attribute.

Contained in: All kinds of sequences.

Children: None

Execution: The data of the target component is sent to the SUT. The TestEventQueue determines the corresponding component, searches for the requested sub-item and sends its index back to QF-Test, where it is stored in a global variable.

Attributes:

Fetch index attributes
Figure 42.69:  Fetch index attributes
Client

The name of the SUT client process from which to query the data.

Variable: Yes

Restrictions: Must not be empty.

QF-Test component ID

The QF-Test ID of the Window, Component or Item node that is to be queried.

The "Select component" button [Select component] brings up a dialog in which you can select the component interactively. You can also get to this dialog by pressing Shift⁠+⁠Return or Alt⁠+⁠Return, when the focus is in the text field. As an alternative you can copy the target node with Ctrl⁠+⁠C or »Edit«-»Copy« and insert its QF-Test component ID into the text field by pressing Ctrl⁠+⁠V.

This attribute supports a special format for referencing components in other test suites (see section 26.1). Furthermore, sub-elements of nodes can be addressed directly without requiring separate nodes for them (see section 5.9). When using SmartIDs, you can address a GUI element directly via its recognition criteria. For more information, refer to SmartID and Component nodes versus SmartID.

Variable: Yes

Restrictions: Must not be empty.

Variable name

The name of the global variable to which the result of the query is assigned (see chapter 6).

Variable: Yes

Restrictions: Must not be empty.

Local variable

This flag determines whether to create a local or global variable binding. If unset, the variable is bound in the global variables. If set, the topmost current binding for the variable is replaced with the new value, provided this binding is within the context of the currently executing Procedure, Dependency or Test case node. If no such binding exists, a new binding is created in the currently executing Procedure, Dependency or Test case node or, if there is no such node in the topmost node on the variables stack, falling back to the global bindings if necessary. See chapter 6 for a detailed explanation of variable binding and lookup.

In order to predefine the option use Enable 'Local variable' attribute by default.

Variable: No

Restrictions: None

QF-Test ID

At the moment the QF-Test ID attribute has no meaning for this type of node.

Variable: No

Restrictions: Must not contain any of the characters '\', '#', '$', '@', '&', or '%' or start with an underscore ('_').

Delay before/after

These attributes cause a delay before or after the execution of the node. If a value is empty, the Default delay from the global options is used.

Variable: Yes

Restrictions: Valid number >= 0

Comment

Here you can enter a comment that explains the purpose of this node. This is the preferred way of documenting the test suite.

Note For detailed documentation, especially for Test set, Test case or Procedure nodes, this text area might not be the right place. There are many excellent editors that are much better suited to this task. The option External editor command lets you define an external editor in which comments can be edited conveniently by pressing Alt⁠+⁠Return or by clicking the External editor button.

You can trigger special behaviors of some nodes using doctags, please see Doctags.

If you enter text in the comment field of a Component node, the node will be considered as 'used' when you want to mark or delete unused components.

Variable: Yes

Restrictions: None

42.10.3
Fetch geometry

Use this node to find out the geometry of a window, component or sub-item in the SUT. The result is stored in up to four local or global variables, one each for the X and Y coordinates, width and height.

This node is useful if you want to set the X and Y coordinates of a Mouse event relative to the right or bottom border of the target component. Simply fetch the component's width and height and define the coordinates using the extended variable syntax for expressions (see section 11.2).

The following table lists the supported sub-item targets for this operation. "(P/S)" indicates the primary/secondary index.

Class Index (P/S) Result
JList Item/- Item
JTabbedPane Tab/- Tab
JTable Column/- Column
JTable Column/Row Cell
JTableHeader Column/- Column title
JTree Node/- Node
Table 42.26:  Components supported by Fetch geometry

Contained in: All kinds of sequences.

Children: None

Execution: The data of the target component is sent to the SUT. The TestEventQueue determines the corresponding component, retrieves its geometry and sends it back to QF-Test, where the values are stored in global variables.

Attributes:

Fetch geometry attributes
Figure 42.70:  Fetch geometry attributes
Client

The name of the SUT client process from which to query the data.

Variable: Yes

Restrictions: Must not be empty.

QF-Test component ID

The QF-Test ID of the Window, Component or Item node that is to be queried.

The "Select component" button [Select component] brings up a dialog in which you can select the component interactively. You can also get to this dialog by pressing Shift⁠+⁠Return or Alt⁠+⁠Return, when the focus is in the text field. As an alternative you can copy the target node with Ctrl⁠+⁠C or »Edit«-»Copy« and insert its QF-Test component ID into the text field by pressing Ctrl⁠+⁠V.

This attribute supports a special format for referencing components in other test suites (see section 26.1). Furthermore, sub-elements of nodes can be addressed directly without requiring separate nodes for them (see section 5.9). When using SmartIDs, you can address a GUI element directly via its recognition criteria. For more information, refer to SmartID and Component nodes versus SmartID.

Variable: Yes

Restrictions: Must not be empty.

Location relative to window

This attribute determines whether the X and Y coordinate of a component or sub-item is calculated relative to its parent component or relative to its parent window. For windows there is no difference.

Variable: No

Restrictions: None

Variable for x

The name of the global variable to which the X coordinate of the window, component or sub-item is assigned (see chapter 6). If you are not interested in the X coordinate, leave this value empty.

Variable: Yes

Restrictions: None

Variable for y

The name of the global variable to which the Y coordinate of the window, component or sub-item is assigned (see chapter 6). If you are not interested in the Y coordinate, leave this value empty.

Variable: Yes

Restrictions: None

Variable for width

The name of the global variable to which the width of the window, component or sub-item is assigned (see chapter 6). If you are not interested in the width, leave this value empty.

Variable: Yes

Restrictions: None

Variable for height

The name of the global variable to which the height of the window, component or sub-item is assigned (see chapter 6). If you are not interested in the height, leave this value empty.

Variable: Yes

Restrictions: None

Local variable

This flag determines whether to create local or global variable bindings. If unset, the variables are bound in the global variables. If set, the topmost current binding for a variable is replaced with the new value, provided this binding is within the context of the currently executing Procedure, Dependency or Test case node. If no such binding exists, a new binding is created in the currently executing Procedure, Dependency or Test case node or, if there is no such node in the topmost node on the variables stack, falling back to the global bindings if necessary. See chapter 6 for a detailed explanation of variable binding and lookup.

In order to predefine the option use Enable 'Local variable' attribute by default.

Variable: No

Restrictions: None

QF-Test ID

At the moment the QF-Test ID attribute has no meaning for this type of node.

Variable: No

Restrictions: Must not contain any of the characters '\', '#', '$', '@', '&', or '%' or start with an underscore ('_').

Delay before/after

These attributes cause a delay before or after the execution of the node. If a value is empty, the Default delay from the global options is used.

Variable: Yes

Restrictions: Valid number >= 0

Comment

Here you can enter a comment that explains the purpose of this node. This is the preferred way of documenting the test suite.

Note For detailed documentation, especially for Test set, Test case or Procedure nodes, this text area might not be the right place. There are many excellent editors that are much better suited to this task. The option External editor command lets you define an external editor in which comments can be edited conveniently by pressing Alt⁠+⁠Return or by clicking the External editor button.

You can trigger special behaviors of some nodes using doctags, please see Doctags.

If you enter text in the comment field of a Component node, the node will be considered as 'used' when you want to mark or delete unused components.

Variable: Yes

Restrictions: None