Scope

6.0+

A scope can be used to narrow the search area for components. This is useful to make component references unique or to improve the readability of a test. Example: There are three panels with address data with identically labeled text fields. The scope can now be set to one of the panels. Now the specified SmartIDs refer exclusively to the fields in this panel.

Scope can also be used to speed up component detection under certain circumstances, especially for windows or web pages that contain a large number of components. An example of this is web applications that load all GUI elements with the status "invisible" from the start, and only make the relevant ones visible. Here it can be useful to use the scope to limit component detection to at least the visible window.

The scope is set in the comment of a node, via the SmartID or even the 'QF-Test ID' of the recorded component with prefixed @scope, for example @scope #myDialog. If the scope should apply to multiple event or check nodes, the scope is set in the comments of a node (for example 'Sequence', 'Test step', or 'Test case') which contains these nodes directly or indirectly via procedure calls.

The scope currently active can be referenced via a SmartID consisting just of the hash symbol #.

If a component is not part of the scope, a ComponentNotFoundException will occur. Scopes can be bypassed when needed by inserting the doctag @noscope in the comments of the respective event or check node or by inserting noscope: at the start of the SmartID. For example, its possible to click a button "Save" via the SmartID #noscope:Save, even though the button is outside of the scope set for the sequence in which the click event is located (see section 46.3).

Scopes can be nested, whereby the inner scope must lie in the outer scope and further restrict it. This, too, can be bypassed with the doctag @noscope. To do this, the doctags @noscope and @scope NEWSCOPE are specified in the comments of the node whose components lie in a scope outside the current one (NEWSCOPE denotes the new scope). The order of the doctags does not matter.

The scope always refers only to the respective nodes and nodes executed within it. Therefore the nodes of a procedure called from inside a scope must either be inside this scope or be marked with #noscope:... or doctag @noscope.

Scopes can be set via SmartIDs or via the 'QF-Test ID' of a recorded 'Component'. Still, they are only respected when referencing a component via SmartID. Referencing a recorded 'Component' will always ignore the current scope.