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,i cleared the first round in Microstrategy and my second round(project manager) is scheduled so can any one tel me what r they asked and gv me some steps how i wil tel them?

1 Answers  


Write test scripts on a scenario where you have to transfer data from one table to another.

0 Answers  


Have you created test scripts and what is contained in the test scripts?

1 Answers  


Say there is some content in an array. what function do you use to get the content of an array?

1 Answers   Fidelity,


There is an error in opening WinRunner "Error: open connection to CRV (-1). Exiting..." and then the winrunner is terminating. Can any one suggest solution for this?

3 Answers  






Can any one plz tell me any site where i could find some free testing tools like winrunner,load runner etc.plz reply on my mail if possible.Regards nitin9360@gmail.com

1 Answers  


How to insert the data in to the data table from the data base records?

2 Answers   CTS, Landscape Technologies,


How to read the third party controls in the application

0 Answers  


What is the Winrunner Framework in your organisation?

1 Answers   CA, TCS, Valtech,


how to open an application

1 Answers   Polaris,


what is the use of add-ins in winrunner?

3 Answers   MBT,


Data Driven test functions in WinRunner are Context sensitive functions or Analog functions?

3 Answers   FCG,


Categories