Relevant for: GUI tests and components
What is the Function Definition Generator?
This dialog box enables you to:
Generate definitions for new user-defined functions.
Add header information to the function you create.
Register the functions to a test object class, if needed.
When you should use the Function Definition Generator
You should use the Function Definition Generator when you have a special function that you would like to use in all your tests or component steps, or when you want to override existing test object methods with special functionality.
Select Design > Function Definition Generator
What do you want to know?
When you add a function, you can specify where this function is available in the scope of your documents.
In the Function definition section of the dialog box, after entering a name, select the relevant options:
- Function type: Whether this function is a full Function or a Sub (subroutine)
Scope: you can specify the function as a Public function or private function. Public functions are available to all tests or components associated with the function library or action, while private functions are limited to use in the document that contains the function.
Note: Make sure not to use any of the built-in function names (for example, GetLastError, MsgBox, or Print). For a list of built-in functions, see the Built-in functions list in the Step Generator (Design > Step Generator).
You can select whether you want your function to override an existing test object method. This override continues until the function is unregistered or the scope of the document is finished (i.e, you finish running a test or action.)
Below the Function definition area, select the following:
- Select the Register to a test object option.
- In the Test object dropdown list, select the test object you want to overwrite.
- In the Operation edit field, enter a unique name for your function or select an existing test object method.
- If you want this function to be the default behavior for the test object, select the Register as default operation checkbox.
Your function will available as an available method for the test object both in the Keyword View and Editor.
Note: If you select the option to Register to a test object., then when the Function Definition Generator creates your function definition, it also automatically adds a RegisterUserFunc statement with the correct argument values immediately after the definition.
In the Arguments box, click the Add button and specify the argument name.
If you are registering the function to a test object class, do not remove the test_object argument, change its location in the list, or modify its Pass Mode.
For each argument, in the Pass Mode cell, specify how the argument value is provided to the function.