Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



I am new to testing. Can anyone send a sample test script in which variables are used to automate t..

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

Post New Answer

More WinRunner Interview Questions

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

0 Answers   John Deere,


what type of licence key r u using for winrunner software in your company?

1 Answers   MBT,


what is the winrunner framework?

1 Answers   Agile Software, GE,


What is the difference between bitmap checkpoint and image checkpoint?

1 Answers   Ness Technologies,


what are the default addin?s provided by WR

2 Answers  


what is the syntax for regular expression.dont send the types like regexp_label,regexp_msw_class

1 Answers   QA,


How can I check the font size and color using winrunner?

3 Answers  


What are the two modes of recording?

0 Answers  


i'm using WR 8.2 version to test a form developed using ORACLE10g. The problem i'm facing is, the form has number of edit objects in that only two objects are not able to recognize by WR while running the script. ( if i FIND that object in the GUI File it highlights the object but if i press SHOW button not able to recognize) can anyone tell me the reason for it??

2 Answers  


what is the TSL statement to find current systsem date?

2 Answers  


How to do the "Exception Handling" in Winrunner ..... Give Me detail Practical approach....(Object Exception,TSL exception & Pop - up also).......?

1 Answers   CTS, SunGard,


winrunner & QTP both are developed by mercury interactive,what is main difference between these two? Thanks in ADVANCE

3 Answers  


Categories