Registered user-defined functions

Relevant for: GUI tests and components

You can register a public user-defined function to a test object to instruct UFT One to use your user-defined function as a method of a specified test object class for the duration of a test or component run, or until you unregister the method.

A registered method applies only to the run session in which you register it. All function registrations are cleared at the beginning of each run session.

When you register a function to a test object class, you can register the function as a new operation for the test object class, or you can choose to override the functionality of an existing operation. You can unregister the function to disable new operations or to return existing operations to their original UFT One behavior.

If you call an external action that registers a method (and does not unregister it at the end of the action), the method registration remains in effect for the remainder of the test that called the action.

The availability of registered user-defined functions differs for tests and components:

For tests

After you register a function to a test object class, it can be called as a method of that test object class, in addition to being available as a global function.

UFT One displays the function in the general Operation list in the Step Generator and in the list of operations available for the test object displayed in the following locations:

  • The Operation box in the Step Generator, when a test object of the relevant class is selected.

  • The Operation column in the Keyword View, when a test object of the relevant class is selected from the Item list.

  • The Editor, when you type the name of a test object of the relevant class and use the statement completion feature.

When you register a function to a test object class, you can optionally define it as the default operation for that test object class. This instructs UFT One to use the function as the test object operation by default, in the following situations:

  • In the Operation column in the Keyword View, when you choose a test object of the relevant class in the Item list.

  • In the Operation box in the Step Generator, when you choose a test object of the relevant class from the Object list.

  • In the Editor, when you drag in a test object of the relevant class from the object repository.

For components

After you register a function to a test object class, it can be called as a method of that test object class, in addition to being available as a global function.

UFT One therefore displays the function in the Keyword View Operation list when a test object of that class is selected from the Item list, as well as in the general Operation list in the Step Generator (for function libraries).

When you register a function to a test object class, you can optionally define it as the default operation for that test object class. This instructs UFT One to display the function in the Operation column in the Keyword View, by default, when you or a Subject Matter Expert choose a test object from the relevant class in the Item list.