Base Class selection

When you define a test object class in the General tab (Test Object Class designer), you define a base class—a test object class that your new one extends. By default, all Web test object classes extend WebElement.

The base class that you select determines the test object class' generic type and default operation (unless you define them specifically) and provides the following:

  • An initial set of test object operations, inherited from the base class. Some of these are displayed in the Operations tab, in which you can override them or add your own test object operations.

  • A list of identification properties that you can choose to include in your test object class. Some of these are displayed in the Properties tab, in which you can also add or modify identification property definitions.

  • If the control you are supporting contains the type of HTML element supported by the base class, your test object class also inherits the implementation that supports the inherited operations and properties. For details, see the section on extending an existing test object class in the UFT One  Web Add-in Extensibility Developer Guide.

Therefore:

  • Select a base class that provides operations and properties that are relevant to the behavior of the control you are supporting.

  • Make sure that the control contains an HTML element of the type supported by the base class. Otherwise, you need to provide implementation for all of the inherited test object operations and properties not supported by WebElement.

  • If the control you are supporting contains the type of HTML element supported by the base class, but this is not the element that represents the control itself, you must implement a JavaScript function that returns the relevant base element.

Changing the Base Class

When you change the base class for a test object class, the list of inherited operations in the Operations tab and the list of base class properties in the Properties tab is automatically updated. Any operations or properties that you added, modified, or overrode remain unchanged.

Therefore, if you select a different base class after defining your lists of operations and properties, be sure to carefully reconsider these lists. Consider the following:

  • You may have implemented operations or properties that are no longer relevant for the new type of class you are extending.

  • Your test object class might no longer be inheriting test object operations that you wanted it to support.

  • Your test object class might include identification properties that previously inherited their implementation from the old base class. You must now make sure that the new base class supports this property, remove that property from the list, or implement your get_property_value function to retrieve its value.

  • Keep in mind that you inherit the implementation for the operations and properties of the new base class only if the control you are supporting contains the HTML element supported by that base class, and that you must implement a JavaScript function to return the relevant HTML element, if that element is not the HTML element representing the control.