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 |
Have you used winrunner in your project?
Write test scripts on a scenario where you have to transfer data from one table to another.
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 is the file extension for object in AUT captured by WR
How to use winrunner?
What are the functions generate when u use GUI Check point?give me some of ones?
How winrunner recognise window/object apart from GUI map file?
is 'Vendor' is a Reserved in WinRunner or not?
how many options are provided in WR login screen
In an Testing Interview, in winrunner the following question asked. what is the use of compile module? how u r implemnted these compile modules in ur project. give any TSL script of compile module?
How does WinRunner recognize objects on the application?
Where are the expected results file will be stored? what is the extension of that?