I am new to testing. Can anyone send a sample test script in
which variables are used to automate the flight login page.

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the purpose of gui spy?

848


How do you suppress a regular expression?

1743


What are the virtual objects and how do you learn them?

959


Explain data parameterization in winrunner?

812


I want to do smoke test in my application but i have learnt the application before recording but im getting an error class name not found while running the script.I want to check each links and each text in my application. Can anybody answer my quesion plz.If it is possible i want test script for Yahoo login form with "New User" Login.

1916


How do you handle unexpected events and errors?

857


What actually happens when you load GUI map?

1026


What is the difference between gui map and gui map files?

820


descriptive program for web application.

1768


What is the extension of gui map file?

1069


What are the synchronization points?

879


What is the purpose of gui map configuration?

854


i would like to know the steps to write tsl exception and object exception with a simple example

1983


How to get the resolution settings?

824


What is the XML test cases creation?

2465