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
Could you anyone share me the path to download the automation tools which are having trial license version?
The title of the window consists of date and time.What is the regular expression to recognize the window as unique?
What are the virtual objects and how do you learn them?
What is the usage of Test case Design Techniques,in Integration/System Testing?
What is the purpose of regexp_label property and regexp_msw_class property?
How do you unload the GUI map?
What do you verify with the database check point custom and what command it generates, explain syntax?
How enviornment veriable can be included into my script. I want to include some information into my Excel file using Test run in WR. like User name of system? waht is function to be used? Please clarify.....
supose 10 times text data is there but it will run 8 times whtat will you do.
What is the purpose of different record methods?
What is a checkpoint and what are different types of checkpoints?
This Is Sekar, Can Any One Of You Help Me? Question: How To Draw Charts In Excel Sheet Using Winrunner Scripts. Thanks, Sekar.
What do you mean by the logical name of the object.
What is the use of test director testing tool?
what is risk?