Different ways of developing automation test with QTP tool.
By Suresh Babu
Different ways of preparing automation tests with QTP
1 Recording a basic test
Record enables you to record the basic operations on AUT. Record loads the objects on which you recorded the operations into object repository and recorded operations will be generated as manual steps in Keyword View and the same will be generated in the form of VB Script in Expert View.
Lab Exercise 1:
Solution :
Record basic script for Agent Login in Flight Application
Step 1 : Step 2 : Step 3 :
Launch QTP Create a New Test Click Record Select Record and Run only on: option in Record and Run Settings
Step 4 : Step 5 : Step 6 : Step 7 :
Record the Login Business Process Click Stop Click Run Click Results (or) Goto Automation => Results
2.
Preparing basic using Drag and Drop from Object Repository
You can also prepare basic test by loading objects into repository then dragging objects from repository and dropping then expert view.
Different ways of developing automation test with QTP tool. By Suresh Babu
Lab Exercise 2:
Solution: Step 1 : Step 2 : Step 3 : Step 4 :
Prepare Agent Login Test using Drag and Drop mechanism.
Click Object Repository Click Add Objects to Local Highlight on the Object to be loaded into OR Load the required objects (Login,AgentName,Password and Ok button) into Object Repository
Step 5 : Step 6 :
Drag the Object from Repository and Drop it in Expert View Specify appropriate method/Property/Value For Ex: Dialog("Login").WinEdit("Agent Name:").Set "SureshBabu"
Step 7 : Step 8 : Step 9 : Step 10 :
Repeat Step 5 & Step 6 on all objects Save the Test Click Run Click Results (or) Goto Automation => Results
3.
Preparing basic test using Keyword View
The Keyword View enables you to create and view the steps of your test in table format. The Keyword View is comprised of a table-like view, in which each step is a separate row in the table, and each column represents the different parts of the steps.
Lab Exercise 3: Prepare Agent Login Test using Keyword View
Solution: Step 1 : Step 2 : Step 3 : Step 4 : Step 5 : Step 6 : Step 7 : Step 8 : Step 9 : Click Object Repository Click Add Objects to Local Highlight on the Object to be loaded into OR Load the required objects (Login,AgentName,Password and Ok button) into Object Repository Click Keyword View Click below Action1 Select object from Repository Select Agent Namem object in the tree and click Ok Enter SureshBabu in value column
Step 10 : Step 11 : Step 12: Step 13 : Step 14 : Step 15 :
Different ways of developing automation test with QTP tool. By Suresh Babu Click on item column and select Password object Enter mercury in value column Click on item Column and select OK object Save the Test Click Run Click Results (or) Goto Automation => Results
4.
Preparing basic test using Expert View
In the Expert View, Quicktest displays each operation performed on your application in the form of a script, comprised of VBScript statements.
Lab Exercise 4:
Solution: Step 1 : Step 2 : Step 3 : Step 4 : Step 5 : Step 6 :
Prepare a basic test for Agent Login using Expert View.
Click Object Repository Click Add Objects to Local Highlight on the Object to be loaded into OR Load the required objects (Login,AgentName,Password and Ok button) into Object Repository Click Expert View develop the following script in the editor Dialog("Login").WinEdit("Agent Name:").Set "SureshBabu" Dialog("Login").WinEdit("Password:").Set "Mercury" Dialog("Login").WinButton("OK").Click
Step 7 : Step 8 : Step 9 :
Save the Test Click Run Click Results (or) Goto Automation => Results
Lab Exercise 5 Solution: Step 1 : Step 2 : Step 3 :
Prepare a basic test for booking a flight
Click Object Repository Click Add Objects to Local Highlight on the Object to be loaded into OR
Step 4 :
Different ways of developing automation test with QTP tool. By Suresh Babu Load the following objects into Object Repository New,DateOfFly,FlyFrom,Flightsutton,From,Ok,Name,Tickets,First,Business,Economy,InsertOrder ( Note: Button,MaskEdBox objects are renamed to New and DateOfFly in OR)
Step 5 : Step 6 :
Click Expert View develop the following script in the editor Window("Flight Reservation").WinButton("New").Click Window("Flight Reservation").Activex("DateOfFly").Click Window("Flight Reservation").WinComboBox("Fly From:").Select "London" Window("Flight Reservation").WinComboBox("Fly To:").Select(0) Window("Flight Reservation").WinButton("FLIGHT").Click Window("Flight Reservation").Dialog("Flights Table").WinList("From").Select(0) Window("Flight Reservation").Dialog("Flights Table").WinButton("OK").Click Window("Flight Reservation").WinEdit("Name:").Set "SureshBabu" Window("Flight Reservation").WinEdit("Tickets:").Set "2" Window("Flight Reservation").WinRadioButton("First").Set "On" Window("Flight Reservation").WinButton("Insert Order").Click
Step 7 : Step 8 : Step 9 :
Save the Test Click Run Click Results (or) Goto Automation => Results