Stage 4: Define the WebExtBook's list of operations and identification properties

In this section, you complete the definition of your test object class by specifying the operations (methods) and identification properties you want to be available for WebExtBook test objects. These definitions are stored in the test object configuration file (WebExtSampleTestObjects.xml).

In later stages, you will add the JavaScript implementation necessary to supports these operations and properties.

Open the Operations tab of the test object class designer

Select the Operations tab on the left side of the WebExtBook test object class designer.

Back to top

Add the Select and GoToUsedBooksPage operations

  1. In the Operations toolbar, click Add .

    A new operation, named Operation1 is added to the list of operations, and selected.

  2. In the Name box, enter GoToUsedBooksPage.

  3. In the Description box, enter Opens the UsedBooks page.

  4. Repeat the steps above to add an operation named Select, with the description Selects the book.

  5. Select the Default operation check box (for the Select operation).

  6. Click Save.

  7. View the remaining options in this tab to learn what is available. For details, see Operations tab (Test Object Class designer).

    The Select and GoToUsedBooksPage operations do not receive any arguments or return a value. Therefore, you do not need to make any additional changes.

Back to top

Add the GoToAuthorPage operation

  1. Add a new operation, named GoToAuthorPage, with the description Opens the Web page for the specified author.

  2. In the Operation Arguments toolbar, click Add .

  3. In the Name column in the Operation Arguments table, enter AuthorName.

  4. Clear the check box in the Optional column, because this is a mandatory argument.

  5. In the Description column, enter The author.

  6. Accept the default values in the Direction and Type columns. These indicate that this is a string value passed to the operation.

  7. Click Save.

Back to top

View the new test object class in the Class View

Click the Class View tab beneath the Project Explorer to open the Class View:

The WebExtBook test object class and the icon you specified for it are displayed in the list of test object classes. The operations that you defined are displayed in the list of operations.

Back to top

Open the Properties tab of the test object class designer

Select the Properties tab (Test Object Class designer).

Back to top

Specify the properties to inherit from WebElement

  1. Select the html tag property and click Inherit From Base Class in the Properties toolbar.

  2. Do the same thing for the html id property.

Back to top

Add the properties: title, authors, price, min_used_price

  1. In the Properties toolbar, click Add .

    A new property, named Property1, is added to the list of properties and selected.

  2. Click on the property name and enter title.

  3. Add additional properties named authors, price, and min_used_price.

Back to top

Add the properties to the relevant groups

The lists of properties on the right side of this tab specify the functionalities for which UFT One uses the properties.

  1. Select the Object Identification - Mandatory group.

    Adding properties to this group instructs UFT One to use these properties for the test object description. (The test object description is a set of properties used to uniquely identify a specific test object.)

    html tag and html id were added to this group automatically.

  2. Double-click on the properties title and authors to add them to the group.

  3. Select the Checkpoints and Output Values group.

    Adding properties to this group makes the properties available for checkpoints and output values in UFT One.

  4. Double-click each of the properties that you created to add them to this group.

    The check box for each of the properties you add is selected by default. This instructs UFT One to select the properties by default when creating checkpoints and output values.

  5. Select the Object Spy group.

    Adding properties to this group makes the properties available in the UFT One Object Spy. All of the properties were added to this group by default.

Back to top

View the changes that Extensibility Accelerator made

View the changes that Extensibility Accelerator made in the test object configuration file.

Open the Project Viewer and double-click the WebExtSampleTestObjects.xml file. In the file, you can see that the operations and identification properties of the WebExtBook test object class are now defined according to the details described in the Web Add-in Extensibility planning checklist.

The operations are defined, with their descriptions, and, where relevant, their arguments. The Select operation is specified as the default operation for the test object class. The properties are defined, with XML attributes indicating the groups to which they belong:

<ClassInfo DefaultOperationName="Select" 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>
        <Operation Name="GoToAuthorPage" PropertyType="Method">
            <Description>Opens the Web page for the specified author.</Description>
            <Argument Name="AuthorName" IsMandatory="true">
                <Type VariantType="String" />
                <AdditionalInfo xsi:type="xsd:string">The author.</AdditionalInfo>
            </Argument>
        </Operation>
        <Operation Name="GoToUsedBooksPage" PropertyType="Method">
            <Description>Opens the UsedBooks page.</Description>
        </Operation>
        <Operation Name="Select" PropertyType="Method">
            <Description>Selects the book.</Description>
        </Operation>
    </TypeInfo>
    <IdentificationProperties>
        <IdentificationProperty Name="authors" ForVerification="true" ForDefaultVerification="true" />
        <IdentificationProperty Name="min_used_price" ForVerification="true" ForDefaultVerification="true" />
        <IdentificationProperty Name="price" ForVerification="true" ForDefaultVerification="true" />
        <IdentificationProperty Name="title" ForVerification="true" ForDefaultVerification="true" />
    </IdentificationProperties>
</ClassInfo>

For details on the structure and content of the test object configuration file, see the UFT One Test Object Schema Help.

Back to top

Continue to Deploy the project to UFT One and test your toolkit support set.