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
How do you find out which is the start up file in winrunner?
What is the purpose of the temp GUI map file?
Name the two modes of recording?
What is the use of gui map and what happens when the gui map file get loaded?
Hi iam a begginer or rather new stsrter to QTP and strugling to start as i have to start writing the automated scripts for the existing manual testing could some one send me some tips ans tricks for a jump start. Any help is greatly appreciated
What is the purpose of regexp_msw_class property?
What is boundary test?
What is the difference between gui map and gui map files?
hi this is uday iam trying for testing job with 3+ yrs of exp if u have qtp faqs materil plz send me thanks in advance
What do you mean by the logical name of the object.
what is risk?
This Is Sekar, Can Any One Of You Help Me? Question: How To Draw Charts In Excel Sheet Using Winrunner Scripts. Thanks, Sekar.
How you integrated your automated scripts from TestDirector?
How do you handle dynamically changing area of the window in the bitmap checkpoints?
How do you handle unexpected events and errors?