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 Micro Focus UFT One Web Add-in Extensibility Developer Guide.
Note: This task is part of a higher-level task. For details, see How to Create or Update Support for a Single Control.
Plan your support.
For details, see the section on planning UFT One support for your toolkit in the Micro Focus UFT One Web Add-in Extensibility Developer Guide.
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.)
- 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.
- Expand the panel for the type of rules you want to create
In the Map to Controls Tab (Test Object Class Designer), select the Default Rules tab, or a browser-specific tab.
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 Micro Focus UFT One Web Add-in Extensibility Developer Guide.
- 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 How to Create a Set of Mapping Rules Automatically .
- 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.
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.
- 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:
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.
Click Done. The Map to Controls tab opens and the highlighting is removed from the applications.
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.)
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.
Continue to select or remove controls to include in the set of rules, as described in How to Create a Set of Mapping Rules Automatically .
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.
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.