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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you execute your tests from windows run command?

1441


supose 10 times text data is there but it will run 8 times whtat will you do.

1540


Can anybody Explain me about the liasing with the developers,and a tester can make a test plan well?plz explain me as soon as possible ,thanx in advance.

1610


How to check property of specific icon is highlighted or not?

564


How can withwin runner to make single scripts which supports multiple languages?

598






What is the purpose of gui spy?

796


Explain difference between winrunner and test director?

628


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

634


descriptive program for web application.

1493


What is the purpose of set_window command?

698


What is the purpose of regexp_msw_class property?

662


How to read the third party controls in the application

1523


What are the reasons that winrunner fails to identify gui object?

577


What is the purpose of gui map configuration?

605


How do you make the configuration and mappings permanent?

609