Writing the first script in QTP 9.2 using Flight Reservation Application

Previous11121314151617181920Next

Now as we are familiar with adding objects to the Local in Object Repository and also Object Identification Let use write a script in QTP 9.2 for inserting an order in Flight Reservation Application in QTP


Step 1: Understand the functionality of the Flight Reservation Application for inserting an Order. What objects are needed to be learnt?

Step 2: Open Object Repository.

Step 3: Populate the Object Repository with the necessary Test Objects i.e to learn all the required Objects in to the Object Repository.

Step 4: The Test Objects to be learned are New button, Date of Flight, Fly From, Fly To, Flight Button, OK button in the Flight Table Dialog Box, Name Text Box and Insert Order Button.

Once all these objects are learned into the Object Repository Start writing the script. QTP supports loading of the parameters, just type the function name like Window and press Shift + 9 the object will be completed.

Window("Flight Reservation").Activate
Window("Flight Reservation").WinButton("New").Click
Window("Flight Reservation").WinObject("Date of Flight:").Type "121212"
Window("Flight Reservation").WinComboBox("Fly From:").Select "Frankfurt"
Window("Flight Reservation").WinComboBox("Fly To:").Select "Los Angeles"
Window("Flight Reservation").WinButton("FLIGHT").Click
Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click
Window("Flight Reservation").WinEdit("Name:").Set "TestUser"
Window("Flight Reservation").WinButton("Insert Order").Click


We save the script as "Sen Insert Order"

Now run the script a new order is inserted and your test result will be displayed as passed.

When you run the script by clicking the Run icon or you can just press F5 Function Key then the Run Window will be opened where you can select the location of the result to be stored.

In the Test Results summary if you Right Click the Test Con Sen Insert Order Summary and select Expand all. The tree view of the objects is displayed and selecting each object you will see the result in detail.


Previous11121314151617181920Next

0 comments:

Post a Comment

/* Tynt Insight tracker ----------------------------------------------- */