Creating the UFT Custom Static-Text Support Class

In the lesson Learning to Support a Simple Control, you created the ImageControlsSupport UFT Java Add-in Extensibility project. In that project, you created the custom support class for the ImageButton control.

In this section you create another custom support class in the same project to support the ImageLabel control.

In most cases, static-text controls do not have identification properties or test object methods that need to be identified in UFT tests. In addition, there is usually no need to record any operations on a static-text control. Therefore, the UFT Java Add-in Extensibility Eclipse plug-in provides a special wizard for creating support classes for static-text controls.

In this wizard, all you have to do is select the ImageLabel class to be supported as a static-text control. The wizard creates the new support class with all the required methods. After the wizard creates the new support class, you modify the methods that the wizard creates to complete the support.

  1. Open the New UFT Custom Static-Text Support Class wizard.

    1. In the Eclipse Package Explorer tab, select the UFT Java Add-in Extensibility project, ImageControlsSupport. Select File > New > Other. The New dialog box opens.

    2. Expand the Unified Functional Testing folder and select UFT Custom Static-Text Support Class.

    3. Click Next. The Custom Class Selection screen opens.

  2. Select the custom class to support, and set the options for the support class.

    1. Expand the com.demo package and select the ImageLabel class.

      Since you are creating support for a class in the ImageControls custom toolkit, the Custom toolkit tree pane looks similar to the one in the lesson Learning to Support a Simple Control, as shown in Creating a New UFT Custom Support Class. The Custom toolkit tree represents the list of classes that you can select to support. The ImageButton class does not appear in this list because you already created support for it.

      In the Custom class inheritance hierarchy pane, you can see the hierarchy of the ImageLabel class you have selected. It extends the ImageControl class, which is part of the same toolkit, and is therefore shown in black.

      The ImageControl custom class is not supported, but the Canvas class does have a matching support class, provided in the package. Therefore the Base support class for the ImageLabel support class you are creating is CanvasCS. This is the class that your new support class extends.

      The Controls of this class represent top-level objects option is disabled because the ImageLabel class is not a container class.

      The name for the ImageLabel support class is, by default, ImageLabelCS. It is recommended to keep the default name.

    2. Click Finish. The Custom Static-Text Support Class Summary screen opens.

  3. View the custom static-text control support class summary.

    Review the planned content of the custom static-text support class, and click OK.

    The following changes are made in the ImageControlsSupport project:

    • The ImageControls.xml file is modified to map the ImageLabel custom class to its support class—ImageLabelCS.

    • A new UFT custom support class, ImageLabelCS, is created in the file in the com.mercury.ftjadin.qtsupport.imagecontrols.cs package. The file is opened and displayed in a tab in the right pane.

      For a detailed explanation of the content of the ImageLabelCS class, see Understanding the New Custom Static-Text Support Class.

  4. The asterisk (*) next to the ImageLabelCS file name (in the ImageLabelCS tab) indicates that it has not been saved. The changes made by the wizard are codependent, and must be saved to prevent discrepancies. Select File > Save, or click the Save button.