I am new to testing. Can anyone send a sample test script in
which variables are used to automate the flight login page.
Answer / ak
Hi,
Any input which you give during recording can be used as
variable and you can then pass the values from different
sources (data tables, database, text files etc).
you can also use function and pass the input values as a
parameter, please see the sample below:
#Flight Reservation Login function
public function Login_FR (in sUserName, in sPassword)
{
#Local variable declaration
auto iRC = E_OK; #Return code
iRC = win_activate ("Login-FR");
iRC+= set_window ("Login-FR",1);
# Enter user name
if (E_OK != (iRC+= edit_set ("User Name", sUserName))
{
report_msg("Failed to enter the user name:"&
sUserName);
win_close ("Login-FR"); #close login window
return(iRC);
}
# Enter password - un-encrypted
if (E_OK != (iRC+= edit_set ("Password", sPassword))
{
report_msg("Failed to enter password: " &
sPassword);
win_close ("Login-FR");
return(iRC);
}
iRC+= button_press ("OK");
if (E_OK == win_exists("Error-Dialog",2))
{
report_msg("Invalid username/password");
win_close("Error-Dialog");
win_close ("Login-FR");
return(iRC);
}
if (E_OK != win_exists ("Flight Reservation",2))
{
report_msg ("Failed to open FR window");
return (iRC);
}
# no-issues
report_msg ("Successfully opened FR window");
return(iRC);
} #function ends
# Function call :
Login_FR ("mercury", "mercury");
Note: Logical names used in above function may not work in
your application, replace with actual names and use it.
Good Luck!
-AK
Is This Answer Correct ? | 0 Yes | 1 No |
What is the TSL function in WinRunner to connect to test director?
1 Answers Infosys, Kanbay, Scope International,
Other than Regression testing where can also it can be used.
The Concatenation Operator in TSL is?
For my web Application I am recording website by WR. but the fuctions are displaying normal recorded fun. such as set_window...etc. eventhough i selected web add-in at start up WR. how to use web functions? such as web_link_click.... pls. guide
During debugging how do you monitor the value of the variables?
what is wrun.ini file..what it consists?
3 Answers BeBo Technologies, Polaris,
what is compile module in WinRunner?
Will TSL supports function overloading and operator overloading?
Can we run WinRunner scripts on the backend?
Tell me the Script to close winrunner from the script itself..
what is automation life cycle?
How to carry out manual testing for a background process which does't have any user interface