Creating and Calling user define funtion

Test Conditons: Creating and Calling user define funtion

1. Crate small add function and make it compile module.

2. calling that function in other test (using user defined data values)


[ Pre Requesties : Nothing ]

1a. open win runner blank test and add this below data

public function add(in a, in b)
{
return a+b;
}


1b. Go to File menu --> Test Properties (Test Properties window will open)
in General Tab --> Test Type= Compile module and ok

1c.Save the test in some location (Ex c:/tt )

2a.Before writing code , you have to load the funtction in to your folder , globally available to all tests.

2b. Go to Tools menu --> General Options
--- Select Folder option in the left pan.
-- Search Path for called test below enter the path of compile module
(c:/tt) and press "+" button to add in to.

2c. Write down the bleow code in the new test

load("c:/tt");
l= create_input_dialog("Enter First value");
j=create_input_dialog("Enter Second Value");
k=add(l,j);
report_msg(k);
unload("c:/tt");


[ load( ) , unload ( ) - to lload and unload from the memory ]

[Same way You can use Winrunner TSL Script to User Defined function

No comments: