Hierarchical Object Recognition

When you record window declarations with the Classic Agent, Silk Test Classic records descriptions based on hierarchical object recognition of the GUI objects in your application. Silk Test Classic stores the declarations in an include file (*.inc). When you record or replay a test case with the Classic Agent, Silk Test Classic references the declarations in the include file to identify the objects named in your test scripts.

The object recognition system of the Classic Agent uses a window declaration identifier as the logical name of an object and a tag or multitag as the attribution to uniquely identify an object. To permit robust operation across browsers, Silk Test Classic uses a complicated system of rules to construct the identifiers and associated attributes.

The window declaration identifiers and tags or multitags are constructed hierarchically from information such as HTML object attributes and closest static text. The class dependent caption and windowID construction rules form the basis for the window declaration identifier, single tag, and multitag construction rules. The Index construction rules are class independent.

Using hierarchical object recognition compared to using dynamic object recognition

Use hierarchical object recognition to test applications that require the Classic Agent. Dynamic object recognition requires the Open Agent.

Alternatively, you can combine the advantages of INC files with the advantages of dynamic object recognition by including locator keywords in INC files. Enhancing INC files with locators facilitates a smooth transition from using hierarchical object recognition to new scripts that use dynamic object recognition. With locators, you use dynamic object recognition but your scripts look and feel like traditional, Silk Test Classic tag-based scripts that use hierarchical object recognition.

You can create tests for both dynamic and hierarchical object recognition in your test environment. You can use both recognition methods within a single test case if necessary. Use the method best suited to meet your test requirements.

Open Agent Example

For example, if you record a test to open the New Window dialog box by clicking File > New > Window in the SWT sample application, Silk Test Classic performs the following tasks:
  • Records the following test:
    testcase Test1 ()
      recording
        SwtTestApplication.WindowMenuItem.Pick()
  • Creates window declarations in the include file for Window menu item. For example:
    window Shell SwtTestApplication
      locator "/Shell[@caption='Swt Test Application']"
      MenuItem WindowMenuItem
        locator "//MenuItem[@caption='Window']"

Classic Agent Example

For example, if you record a test to open the New Window dialog box by clicking File > New > Window in a sample application, Silk Test Classic performs the following tasks:
  • Records the following test:
    testcase Test1 ()
      recording
        SwtTestApplication.File.New.xWindow.Pick()
  • Creates window declarations in the include file for File menu, New menu item, and xWindow menu item. For example:
    Menu File
      tag "File"
      MenuItem New
        tag "New.."
        MenuItem xWindow
          tag "Window"