Map a test object class to application controls

This task describes how to define and test the mapping rules for a test object class. The mapping rules indicate the types of controls for which UFT One should use the test object class. You can create different rules to support different browser versions.

For more details on mapping rules, see the section on teaching UFT One to identify the test object class to use for a custom Web control in the UFT One  Web Add-in Extensibility Developer Guide.

Note: This task is part of a higher-level task. For details, see Create or update support for a single control.

Prerequisites

  1. Plan your support.

    For details, see the section on planning UFT One support for your toolkit in the UFT One  Web Add-in Extensibility Developer Guide.

  2. Open an application that contains the relevant controls.

    With an Extensibility Accelerator project open, run one or more applications that contain the controls you want to support. Make sure that the page is fully loaded and the relevant controls are visible. (You must run Extensibility Accelerator and open a project before you open the Web browsers.)

Back to top

Create a tab for a browser-specific rule set - Optional

In the Map to Controls tab (Test Object Class designer), if you create mapping rules only in the Default Rules tab, these rules are used to map your controls to a test object class, for all browsers you work with.

If you want UFT One to use different mapping rules when working with your controls in different browser versions, click the Add Browser-Specific Rules to add tabs for additional sets of rules. The Add Browser dialog box opens, enabling you to specify the browser details.

Perform the next steps in each tab to create the necessary set of rules in each one.

Back to top

Expand the panel for the type of rules you want to create

  1. In the Map to Controls Tab (Test Object Class Designer), select the Default Rules tab, or a browser-specific tab.

  2. Select the type of rules you want to create, and expand the relevant panel.

    Available types: Identify Control, Call Identification Function, Ignore Control.

    If you want to create more than one type of rules, perform the next steps in each relevant panel.

    Note: If you create a set of Call Identification Function rules and a set of Ignore Control rules, UFT One ignores the set of Ignore Control rules when attempting to identify the control.

    For more details on how UFT One uses the different types of rules, see the section on teaching UFT One to identify the test object class to use for a custom Web control in the UFT One  Web Add-in Extensibility Developer Guide.

Back to top

Create a set of mapping rules automatically

Perform this step separately in each relevant Rule Creation panel and within each relevant browser-specific tab.

For details, see Create a set of mapping rules automatically .

Back to top

Edit mapping rules manually - Optional

In the Rule Editor Area (in each rule creation panel and within each relevant browser-specific tab in the Map to Controls tab), you can make manual changes to the automatically created rules, or create your own rules.

For example, you can:

  • Add and delete rules.

  • Change the order or logic of rules.

  • Generalize rules by defining regular expressions for property values.

  • Modify automatically created regular expressions to make them more accurate.

The rules are stored in the relevant Identification element in the toolkit configuration XML file, in Conditions elements.

For information on the options in the rule editor, see the Rule Editor Area section in Map to Controls tab (Test Object Class designer).

Tip: You can improve performance by limiting the identification process of custom controls to HTML elements with HTML tags you specify. However, you must do this manually in the toolkit configuration file, and the definitions that you add will not be displayed in Extensibility Accelerator. For details, see the section on the HTMLTags element in the Toolkit Configuration Schema.

Back to top

Test and update your mapping rules

Test your mapping rules on an application and update them if necessary.

You can test the rules in each panel separately, and test all of the rules together.

Follow one of the procedures described below:

To test one set of rules without modifying:

  1. In the Map to Controls tab (Test Object Class designer), select the set of rules that you want to test and click Test Rules.

    The following happens:

    • Extensibility Accelerator is hidden.

    • All of the controls that match the mapping rules are highlighted in all Web applications that are open in a browser that is relevant to this set of rules. In many cases you can open or navigate to additional applications or Web pages at this point. Once the application or page loads successfully, the matching controls are highlighted in it as well.

      If a specific page does not load properly when navigating to it at this point, load that page in an additional browser before beginning the session for testing the rules.

      Note: Controls are highlighted only in browsers that are opened after you open a project in Extensibility Accelerator.

    • A Done button is displayed at the top of the screen.

  2. Click Done. The Map to Controls tab opens and the highlighting is removed from the applications.

To test one set of rules and update them if necessary:

  1. Open the applications on which you want to test the rules, and make sure that the pages are fully loaded and the relevant controls are visible. (You must run Extensibility Accelerator and open a project before you open the Web browsers.)

  2. In the Map to Controls tab (Test Object Class designer), select the set of rules that you want to test and click Test & Refine.

    The following happens:

    • Extensibility Accelerator is hidden.

    • The Create Rules and Close buttons are displayed at the top of the screen, similarly to what happens when you click Select Controls.

    • A control selecting session for automatically creating rules begins. All of the controls that match the existing mapping rules are marked as selected in all Web applications that are open in a browser that is relevant to this set of rules.

  3. Continue to select or remove controls to include in the set of rules, as described in Create a set of mapping rules automatically .

To test all of the rules together:

Click Test All Rules.

All of the controls that match the mapping rules, in all open web applications, are highlighted.

The rules from each tab are applied to the corresponding open browsers.

For example, if you have a Default Rules tab, and a Chrome tab, the default rules are applied to any open Internet Explorer windows, the Chrome rules are applied to any open Chrome browser.

In addition, when the defined rules warrant it, the identification function that you implemented is also called to assist in identification of the relevant controls. For example, the identification function is called if a control's properties meet the rules defined in a set of Call Identification Function rules, or if no rules are defined at all.

See also How Extensibility Accelerator tests your control mapping.

Back to top