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

what happens when the script is executed in verify mode

3 Answers  


In the system of coordinates used by WinRunner,the origin(0,0 coordinate)is located in the --- screen?

3 Answers   FCG,


How do you invoke a text file from winrunner?

6 Answers   BeBo Technologies,


How to check the Back Ground Color of screen in Winrunner?

3 Answers   3i Infotech, Satyam,


In the flight example flight(select flights) button is recognizing ,it recognizes as object how to gui map configure to button pls explain

2 Answers   Satyam,


How do you copy and move objects between different gui map files?

1 Answers  


Tell US the Short key to open the dialogs of windows.

1 Answers  


what is def of MAINTEST

1 Answers   Exalt,


Name the three modes of running the scripts?

1 Answers  


what is validation? What is verificaion? What is the diffefernce between validation and verification?

8 Answers   TCS,


How should we create a compiled module? What is its importance?

1 Answers  


what is agile testing

2 Answers  


Categories