Stage 2: Create a new test object class

In this section you create the WebExtBook test object class that you want UFT One to use to represent the Book control, and define its basic characteristics.

Create a new test object class

Click Add Test Object Class in the Workflow window.

  • A test object class designer opens in a new tab in the main document area. The designer opens to the General tab (Test Object Class designer).

  • In addition, a new JavaScript file is created, as you can see in the Project Explorer. This file will contain the JavaScript functions that you design to support the sample Book control.

  • In the Workflow window, the Edit Test Object Class area is now highlighted, indicating the current stage of the project design.

Back to top

Define the name, description, and icon for the test object class

  1. In the Name box (in the General tab of the test object class designer), replace the default test object class name with WebExtBook.

    The name in the tab of the designer changes as you type, and an asterisk (*) in the tab indicates that you have made changes that have not yet been saved.

  2. Click Save .

    The JavaScript file name is modified, to match the name of the test object class, the name of the test object class is updated in the configuration (XML) files, and the files are saved.

  3. In the Description box, enter The test object class used to represent a Book control.

    This description is for your own records; it is not displayed in UFT One.

  4. Replace the default icon used to represent WebExtBook test objects, which you can see displayed beneath the description:

    Click the browse button to the right of the Icon File box, then browse to and select C:\Users\Public\Documents\ExtAccTool\Samples\WebExtSample\Res.

    The icon file is imported into the Res folder in your project, as you can see the file in the Project Explorer. The file name is displayed in the Icon File box, and the icon image is displayed as well.

  5. Click Save All.

Back to top

Consider the rest of the test object class definitions

Consider the rest of the test object class definitions that are available in this tab:

Back to top

View the content of the configuration files

View the content of the configuration files that were created:

  1. Double click the WebExtSample.xml file in the Project Explorer.

    The file opens in an XML Editor in a separate tab. It contains the basic structure of a toolkit configuration file, which introduces your toolkit support set to UFT One:

    A root Controls element, containing a Control element for the WebExtBook test object class, specifying the JavaScript file that will contain the implementation of the support.

    In addition, the file contains a browser independent Identification element, which will be updated when you perform Stage 3: Create rules to map the test object class to the control:

    <Control TestObjectClass="WebExtBook">
        <Settings>
            <variable name="default_imp_file" value="JavaScript\WebExtBook.js" />
        <Settings>
        <Identification>
            <Browser name="*" />
        </Identification>
    </Control>
    

    For details on the elements and attributes in the toolkit configuration file, see the Toolkit Configuration Schema Help.

  2. Double click the WebExtSampleTestObjects.xml file in the Project Explorer to open it another XML editor tab. The file contains the basic structure of a test object configuration file, which introduces your WebExtSample environment and its test object classes to UFT One.

    The PackageName attribute in the TypeInformation element associates this test object configuration file (and the test objects defined in it) with the WebExtSample environment. If, when UFT One opens, you do not select the WebExtSample environment, UFT One ignores the test object class definitions in this file.

    Additional elements contain the test object class specifications that you defined in the designer:

    <TypeInformation PackageName="WebExtSample" AddinName="Web">
        <ClassInfo GenericTypeID="Object" Name="WebExtBook" BaseClassInfoName="WebElement">
            <Description>The test object class used to represent a Book control.
            </Description>
            <HelpInfo />
    
            <IconInfo IconFile="INSTALLDIR\Dat\Extensibility\Web\Toolkits\WebExtSample\Res\WebBook.ico" IconIndex="0" />
            <TypeInfo />
            <IdentificationProperties />
        </ClassInfo>
    </TypeInformation>
    
  3. For details on the elements and attributes in the test object configuration file, see the UFT One Test Object Schema Help.

  4. Close the XML files.

Back to top

Continue to Stage 3: Create rules to map the test object class to the control.