Registering user-defined functions as test object methods

Relevant for: GUI tests and components

To register a user-defined function as a test object method, you enter a RegisterUserFunc statement in an action or function library. The RegisterUserFunc statement specifies the test object class, the name of your function, and the name of the test object method that should call your function.

In this statement, you can also instruct UFT to use the function as the default operation for the test object class.

You can register the same function to more than one test object class, using the same operation name for different test object classes, or different names.

After the RegisterUserFunc statement runs, your method becomes a recognized method of the specified test object class for the remainder of the run session, or until you unregister the method.

When UFT loads a function library it runs all the statements in the function library. Therefore, if the function you are registering is defined in a function library, we recommend including the RegisterUserFunc statement in the function library as well so that the method is immediately available for use in any test or component using that function library.

For task details, see Register the function to a test object class - optional .