When you add a function to the Function Generator, you specify the following:
Note that after you add a function to the Function Generator, you should associate the function with a category. See “Associating a Function with a Category”
You use the generator_add_function TSL function to add a user-defined function to the Function Generator.
To add a function to the Function Generator:
Note: You must run the test script in order to insert a new function into the Function Generator.
Defining Function Arguments
The generator_add_function function has the following syntax:
For each argument in the function you define, you supply the name of the argument, how it is filled in, and its default value (where possible). When you define a new function, you repeat the following parameters for each argument in the function: arg_name, arg_type, and default_value.
“browse()” The value of the argument is evaluated by pointing to a file in a browse file dialog box. Use browse when the argument is a file. To select a file with specific file extensions only, specify a list of default extension(s). Items in the list should be separated by a space or tab. Once a new function is defined, the browse argument is defined in the Function Generator by using a Browse button.
“point_object”:The value of the argument is evaluated by pointing to a GUI object (other than a window). Use point_object when the argument is the logical name of an object. Once a new function is defined, the point_object argument is defined in the Function Generator by using a pointing hand.
“point_window”:The value of the argument is evaluated by pointing to a window. Use point_window when the argument is the logical name of a window. Once a new function is defined, the point_window argument is defined in the Function Generator by using a pointing hand.
“select_list (01)”: The value of the argument is selected from a list. Use select_list when there is a limited number of argument values, and you can supply all the values. Once a new function is defined, the select_list argument is defined in the Function Generator by using a combo box.
“type_edit”:The value of the argument is typed in. Use type_edit when you cannot supply the full range of argument values. Once a new function is defined, the type_edit argument is defined in the Function Generator by typing into an edit field.
The following are examples of argument definitions that you can include in generator_add_function statements. The examples include the syntax of the argument definitions, their representations in the Function Generator, and a brief description of each definition.
The function_name is window_name. The description is “This function...”. The arg_number is 1. The arg_name is Window Name. The arg_type is point_window. There is no default_value: since the argument is selected by pointing to a window, this argument is an empty string.
When you select the window_name function in the Function Generator and click the Args button, the Function Generator appears as follows:
The function_name is state. The description is “This function...”. The arg_number is 1. The arg_name is State. The arg_type is select_list. The default_value is 0.
When you select the state function in the Function Generator and click the Args button, the Function Generator appears as follows:
The function_name is value. The description is “This function...”. The arg_number is 1. The arg_name is Value. The arg_type is type_edit. There is no default_value.
When you select the value function in the Function Generator and click the Args button, the Function Generator appears as follows:
Defining Property Arguments
You can define a function with an argument that uses a Context Sensitive property, such as the label on a pushbutton or the width of a checkbox. In such a case, you cannot define a single default value for the argument. However, you can use the attr_val function to determine the value of a property for the selected window or GUI object. You include the attr_val function in a call to the generator_add_function function.
The attr_val function has the following syntax:
attr_val ( object_name, "property);
You can either define a specific property, or specify a parameter that was defined in a previous argument of the same call to the function, generator_add_function. For an illustration, see example 2, below.
In this example, a function called “check_my_button_label” is added to the Function Generator. This function checks the label of a button.
The “check_my_button_label” function has two arguments. The first is the name of the button. Its selection method is point_object and it therefore has no default value. The second argument is the label property of the button specified, and is a type_edit argument. The attr_val function returns the labelproperty of the selected GUI object as the default value for the property.
The following example adds a function called “check_my_property” to the Function Generator. This function checks the class, label, or active property of an object. The property whose value is returned as the default depends on which property is selected from the list.generator_add_function ("check_my_property","This function checks an object’s
The first three arguments in generator_add_function define the following:
The first argument of “check_my_property” determines the object whose property is to be checked. The first parameter of this argument is the object name. Its type is point_object. Consequently, as the null value for the third parameter of the argument indicates, it has no default value.
The second argument is the property to be checked. Its type is select_list. The items in the list appear in parentheses, separated by field separators and in quotation marks. The default value is the class property.
The third argument, value, is a typeedit argument. It calls the attr_val function. This function returns, for the object defined as the function’s first argument, the property that is defined as the second argument (class, label or active).
WinRunner Related Interview Questions
|SILK TEST Interview Questions||LoadRunner Interview Questions|
|WinRunner Interview Questions||HTML Interview Questions|
|QTP Interview Questions||Manual Testing Interview Questions|
|OpenStack Interview Questions||Automation Testing Interview Questions|
|API testing Interview Questions||Rational robot Interview Questions|
|Selenium IDE Interview Questions||Performance Testing Interview Questions|
|Test Director Interview Questions|
Winrunner At A Glance
Understanding How Winrunner Identifies Gui Objects
Understanding Basic Gui Map Concepts
Working In The Global Gui Map File Mode
Editing The Gui Map
Merging Gui Map Files
Configuring The Gui Map
Learning Virtual Objects
Checking Gui Objects
Working In The Gui Map File Per Test Mode
Working With Web Objects
Working With Activex And Visual Basic Controls
Checking Powerbuilder Applications
Checking Table Contents
Creating Data-driven Tests
Synchronizing The Test Run
Defining And Using Recovery Scenarios
Handling Web Exceptions
Using Regular Expressions
Enhancing Your Test Scripts With Programming
Creating User-defined Functions
Creating Compiled Modules
Calling Functions From External Libraries
Creating Dialog Boxes For Interactive Input
Understanding Test Runs
Analyzing Test Results
Running Batch Tests
Running Tests From The Command Line
Controlling Your Test Run
Setting Properties For A Single Test
Setting Global Testing Options
Customizing The Test Script Editor
Customizing The Winrunner User Interface
Setting Testing Options From A Test Script
Customizing The Function Generator
Initializing Special Configurations
Integrating With Quicktest Professional
Managing The Testing Process
Testing Systems Under Load
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.