Tuesday, October 2, 2012

Anatomy of QTP

Add in Manager is a feature provided by QTP which makes QTP compatible with desired environments. QTP provides 3 add ins such as visual basic, active x and web. If the user does not select any add in by default qtp supports standard windows applications.

How to launch QTP?
start->programs->Quick Test professional->Quick Test professional

Now Add in Manager will display.

Do not select any add in and click on OK. Now QTP displays 4 options.

1)Record
2)Open existings
3)Blank Test

Do remember in QTP that test means script.

Now QTP window displays.

Go to Tools->Object Identification->Environment there you can see standard windows.

Just to be clear: when you say "Windows apps", many languages can provide windowed applications. If you are targeting MS Windows platform, working with the OS, registry, clipboard, etc, THAT is what I would call "Windows Programming", where you leverage the OS. Otherwise, seems like it would be simply "Programming in a Windows Environment", and you can use any language that is appropriate. 

For Windows programming refer http://www.sunlightd.com/archive/windows/gui/DialogBoxes.aspx

Since you have not selected any add in by default QTP compatible with Standard windows applications

Now Close the QTP window and again launch the QTP window and select add in web and visual basic.

You will see under Tools menu->Object Identification the environments are visual basic, standard windows and Web.

Now let us discuss about parts of the QTP:

There are 7 parts in QTP
1) Test pane
2) Active Screen
3) Data table
4) Debug viewer pane
5) Missing resources pane
6) Information
7) Tool options

Menu bar has File Edit View Help etc. Whenever any feature you want to access in easy way you need to go to view menu and select that particular feature.

Upon selecting that feature you will get an option to that particular window that hide toggle which is different from minimize and maximize options. Here upon mouse over that particular get focus and upon mouse moved away from that window automatically that window will minimized.

Now we will discuss about each part of the QTP in details

First one is Test Pane:
As you know pane is an area so Test pane means here script area where you can view, edit and write scripts.

Here select add in visual basic and launch the QTP application. Now I am recording a visual basic application which is nothing but Calculator.

Vbwindow("Calculator").VbEditbox("value1").set "10".
Vbwindow("Calculator").VbEditbox("value1").set "20".
Vbwindow("Calculator").Vbbutton("add").click
Vbwindow("Calculator").Vbbutton("sub").click
Vbwindow("Calculator").Vbbutton("mul").click
Vbwindow("Calculator").Vbbutton("div").click

So inorder to understand the vb script we need to go reverse way so that you will have better understanding.

We need to identify the top most object and then child object if exists and then child object if exists until you find final object.

After you have identify you need to choose operations you need to perform.

If the operation requires any value you need set using keyword set and in double quotes you need to provide value.

if the operation requires only operation then call that operation simply.



















No comments: