Custom Support Test Object Methods Screen

This topic describes the Custom Support Test Object Methods screen in the New Custom Support Class Wizard, where you choose test object methods to inherit, override, or add and define their behavior.

Overview

The Custom Support Test Object Methods screen displays the test object methods defined for the test object class you mapped to the custom control. You use this screen to select test object methods whose support you want to implement or override with new functionality and to add new test object methods.

Wizard map

Custom Class Selection Screen > Test Object Class Selection Screen > Custom Support Test Object Identification Properties Screen > Custom Support Test Object Methods Screen > Custom Control Recording Support Screen > New Test Object Class Details Screen > Custom Control Support Class Summary Screen

Screen details

Methods Inherited from Base Support Class

The left pane displays all of the test object methods that are defined for the test object class you selected and are implemented by the base support class. These are the test object methods that will be inherited by the support class you are creating. You select any test object methods whose support you want to override with a different implementation.

When the wizard creates the support class file, it adds a support method stub, named <test object method name>_replayMethod, for each test object method you selected. The support method stubs return the same values as the support methods in the base support class. You can implement the new support methods to match the needs of your custom control.

Note: If you selected the Same as base support class option in the Test Object Class Selection Screen, the wizard does not know which test object class is mapped to the custom control. As a result, no test object methods are displayed in the left pane. After the wizard creates the new support class, you can override any of the replay methods that it inherits from the base support class by adding them to the class manually.

Additional Methods Required for Test Object Class

The right pane displays the test object methods that are defined in the test object class you selected, but are not supported by the base support class.

You can modify the list in this pane using the Add, Remove, and Modify buttons.

Note that modifying the name of a method is equivalent to removing the method and adding a new one. For more information, see Understanding the Test Object Method Dialog Box.

Tip: To add test object methods after the support class is created, use the Add Test Object Method button or select UFT > Add Test Object Method in Eclipse.

For each of the test object methods in this pane, the wizard adds support method stubs to the support class it creates. The support method stubs return the error value Retval.NOT_IMPLEMENTED until you implement them to match the needs of your custom control.

If you add test object methods to this list, the wizard adds them to the test object class definition in the test object configuration file. For information on the structure and content of this file, see the Test Object Schema Help.

Note: If you selected the Same as base support class option in the Test Object Class Selection Screen, the wizard does not know which test object class is mapped to the custom control. As a result, no test object methods are displayed in the right pane. If you add a test object method, the wizard adds the appropriate replay method stub to the support class it creates. However, the test object method is not added to any test object class definition.

Considerations for Adding and Removing Test Object Methods to the List

  • If you add test object methods to this list, they are added to the existing test object class. This means that the new methods appear in OpenText Functional Testing for all test objects of this class, regardless of whether or not they are supported for these objects. In a GUI test, if you call a test object method for an object, and that method is not supported, a run-time error occurs.

    Therefore, if you plan to add test object methods to support a custom control, it is recommended to create a new test object class based on the existing one, instead of using the existing test object class.

  • If you remove a test object method from this list, it is no longer supported for this custom class. However, it is still part of the test object class definition. Therefore, it still appears in the list of test object methods in OpenText Functional Testing.

    If you use this test object method on a custom control in GUI tests, a run-time error occurs. For example, although a drop-down-list control is supported as a List test object, if you select the select_range test object method for a drop-down-list control, and it is not supported, a run-time error occurs.

Understanding the Test Object Method Dialog Box

When you click Add or Modify in the Custom Support Test Object Methods Screen, the Test Object Method dialog box opens.

The Test Object Method dialog box enables you to specify details for the test object methods listed in the Additional methods required for test object class pane in the Custom Support Test Object Methods screen.

The Test Object Method dialog box contains the following items:

Option

Description

Method name

The name of the test object method as it appears in GUI tests. The name should clearly indicate what the test object method does so that a user can select it from the Step Generator or in the Keyword View. Method names cannot contain non-English letters or characters. In addition, method names must begin with a letter and cannot contain spaces or any of the following characters:  ! @ # $ % ^ & * ( ) + = [ ] \ { } | ; ': " , / < > ?

    Note:
  • Do not use the name of a test object method that already exists in the support class. (The Custom Support Test Object Methods Screen lists the test object methods that are already included in the support class.) If you want to override the implementation of an existing test object method, select it in the left pane of the Custom Support Test Object Methods screen (rather than creating a new test object method with the same name).

  • Modifying the name of a method is equivalent to removing the method and adding a new one.

Arguments

A list of the test object method arguments and their types.

  • The first argument of every test object method must be obj (Object). You cannot remove, modify, or move this argument.

  • You cannot modify the signature of a test object method that belongs to the existing test object class that you selected in the Test Object Class Selection Screen. (This means that in an existing test object method, you cannot add or remove arguments, or change their types.)

Method returns a string value

Indicates that this test object method returns a string value in addition to the return code. (The return value can be retrieved and used in later steps of a GUI test.)

If you select this check box:

  • the wizard adds the ReturnValueType element to the test object method definition that it creates in the test object configuration file.

  • the method stub that the wizard creates in the new support class, returns the object Retval(""), which includes the return code OK and an empty string.
    When you implement the replay method for this test object method, you can use different types of Retval. If the method succeeds, return OK and an appropriate string value. Otherwise, return only the relevant error code. For more information, see the API Reference.

Description

The tooltip that is displayed when the cursor is positioned over the test object method in the Step Generator, in the Keyword View, and when using the statement completion functionality in the Editor.

Documentation

A sentence that describes what the step that includes the test object method actually does. This sentence is displayed in the Step documentation box in the Step Generator and in the Documentation column of the Keyword View.

You can insert arguments in the Documentation text by clicking  and selecting the relevant argument. The arguments are then replaced dynamically by the relevant values.

Adding or Modifying an Argument for a Test Object Method

When you click Add or Modify in the Test Object Method dialog box, the Test Object Method Argument dialog box opens. The Test Object Method Argument dialog box enables you to specify the details for each of the arguments you list in the Test Object Method dialog box.

The Test Object Method Argument dialog box contains the following items:

Option

Description

Name

The name of the argument as it appears in GUI tests. The argument name should clearly indicate the value that needs to be entered for the argument. Argument names must contain only alphanumeric characters. In addition, argument names must begin with a letter and cannot contain spaces or any of the following characters:  ! @ # $ % ^ & * ( ) + = [ ] \ { } | ; ' : " , / < > ?

Type

Specifies that test steps with this test object method do one of the following: 

  • Require String values for this argument

  • Allow Variant values

Even if you define the Type as Variant, all arguments are passed to the replay methods as strings. In addition, when you record test steps, the arguments are always registered as strings.

Note: If you want to define a list of possible values for an argument, you must do so manually. In the test object configuration file, define the list of values and change the argument's type to ListOfValues.

For more information, see the Test Object Schema Help.

Mandatory argument

Specifies whether to require the person writing the test to supply a value for the argument.

In the list of arguments, mandatory arguments cannot follow optional arguments.

Default value

If an argument is optional, you can provide a default value to use if no other value is defined.

This option is not available for mandatory arguments.

Next steps

When you click Next, one of the following screens open: