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

Where do you found that you can't use winrunner for automation?

0 Answers  


How does winrunner Recognize Objects in an application?

1 Answers   BirlaSoft,


Where are test cycle folders created if TSL Script is not saved

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,


How do you configure gui map?

0 Answers  


If the object does not have a name then what will be the logical name?

1 Answers  


Please give an example for test case.

1 Answers  


The GUI MAp Editor or Rapid Fire test are not learning the GUI of any window or any object..The pointer conevrts to hand and everthing hangs till i don't press Ctrl+Alt+Del. Help me!!!

1 Answers  


which TSl statement is used in winrunner to stop the Run

5 Answers  


What is the automation process in winrunner?

3 Answers   Second Foundation,


Explain the purpose of gui map configuration?

0 Answers  


What is the purpose of the temp GUI map file?

0 Answers  


Categories