Teaching UFT One to Identify the Test Object Class to Use for a Custom Web Control

After you define the test object classes that you want UFT One to use to represent your controls, you need to map each type of control to a specific test object class.

This identification can be performed using JavaScript functions or condition elements that check the control's properties and determine the test object class that should represent it. To improve UFT One's performance of learning custom controls and running steps on them, define the identification elements in such a way that JavaScript function calls are avoided as much as possible.

You can limit the identification process of custom controls to HTML elements with HTML tags you specify. This can further improve performance, and is more efficient than defining conditions that check the tagName property.

You provide information enabling UFT One to identify which test object class to use for the different controls in the Controls\CommonIdentification element in the toolkit configuration file, or in the Control\Identification element. In these elements you can define the following:

  • A set of HTML tags per test object class. When UFT One handles each control, it continues the identification process according to the definitions in the Identification element, only for HTML elements with the specified HTML tags.

  • A set of conditions per test object class. When UFT One handles each control, UFT One checks the control's HTML properties against the conditions you define in each Control element, and locates the first one whose conditions the control meets.

    Note: You can define different conditions and HTML tags for UFT One to use when running on different browsers.

  • One JavaScript identification function for the whole toolkit. When UFT One handles each control, UFT One calls this function, which checks the control's properties and returns the name of the appropriate test object class.

    Note: If you specify an identification function at the toolkit level (in the Controls\CommonIdentification element) and also conditions at the test object class level (in the Control\Identification element), UFT One checks the conditions before calling the JavaScript function, to avoid unnecessary calls.

  • A JavaScript identification function per test object class When UFT One handles each control, UFT One calls each of these JavaScript functions, in the order in which the test objects are defined in the toolkit configuration file. Each function checks whether the test object class for which it is defined should represent the control. UFT One uses the first test object class whose function returns true.

    This method of identification should be avoided if possible because it significantly affects performance, as it involves many calls to JavaScript functions for each control.

    Note: If you specify an identification function at the toolkit level (in the Controls\CommonIdentification element), UFT One does not call any identification functions specified at the test object class level (in the Control\Identification element).

  • You can also combine the use of conditions and JavaScript functions, defining conditions that limit the calls to the JavaScript function you define, based on the control's properties. For more information, see Using the Conditions Elements.

For more information on writing JavaScript functions for Web Add-in Extensibility, see Designing JavaScript functions for your toolkit support set.

For information on the structure and syntax of the identification elements, see the Toolkit Configuration Schema Help.

After you teach UFT One to identify the test object class to use for the custom control, you can test the basic functionality of your toolkit support set. For more information, see Testing the Toolkit Support Set During Development.

See also: