qtp knowledge

5
Object repository in QTP: Object repository is the heart of QTP, if you don’t understand it properly than you will face lots of problems in developing and testing of your application. Please keep in mind following points regarding object repository: - Test objects can be saved in two types of object repository Local object repository and Shared object repository - A local object repository stores objects in a file that is associated with one specific action, so that only that action can access the stored objects - A shared object repository stores test objects in a file that can be accessed by multiple tests. - When you want to create test (New project) you have two ways to store the objects in your test. - Store the objects in corresponding local object repository OR - Store the objects in one or more Shared object repository. (Smart ,advanced and efficient way) because it reduces maintenance and enhance reusability of your tests. Object repository concept: - In testing the most efficient way to save objects is in shared object repository. - You can use the same shared object repository for multiple actions, if the actions include the same object. - If an object with the same name is located in both the local object repository and in a shared object repository linked with the same action, the action uses the local object repository first. - If an object with the same name is located in more than one shared object repository linked with the same action, the first occurrence of

Upload: reddysd

Post on 05-Jan-2016

213 views

Category:

Documents


1 download

DESCRIPTION

here is basics for qtp bigginers

TRANSCRIPT

Page 1: Qtp Knowledge

Object repository in QTP:

Object repository is the heart of QTP, if you don’t understand it properly than you will face lots of problems in developing and testing of your application.

Please keep in mind following points regarding object repository:

- Test objects can be saved in two types of object repositoryLocal object repository and Shared object repository

- A local object repository stores objects in a file that is associated with one specific action, so that only that action can access the stored objects

- A shared object repository stores test objects in a file that can be accessed by multiple tests.

- When you want to create test (New project) you have two ways to store the objects in your test.

- Store the objects in corresponding local object repository OR- Store the objects in one or more Shared object repository. (Smart ,advanced and efficient way) because it reduces maintenance and enhance reusability of your tests.

Object repository concept:

- In testing the most efficient way to save objects is in shared object repository.- You can use the same shared object repository for multiple actions, if the actions include the same object.- If an object with the same name is located in both the local object repository and in a shared object repository linked with the same action, the action uses the local object repository first.- If an object with the same name is located in more than one shared object repository linked with the same action, the first occurrence of the object will be used by action.- You can see window which is the Object Repository window (Resource->Object Repository or CTRL+R) in which you can see all objects of local and shared object repository.- In Left side of the window, black text shows objects of local object repository- Gray text shows objects of shared object repository.- This figure I have taken from help of QTP, in which you can see the object detail of “buyFlights” on the left hand side.- You can view all objects of QTP (local and shared) and you can also modify its property according to your requirements of application.

Page 2: Qtp Knowledge

- You can copy objects from shared repository to local repository.- This is the basic concept of Local and shared object repository if you want more detail on object repository you will find it in help of QTP.

If you want to use "shared repository file", you can use it by associating with that new test.(Edit->action->action propertis and then

go to associate repository tab)After associating "shared object repository" now when again if you are

recording new thing again new objects will be created in your local object repository.

So Now you can again save these new objects to second object repository and later you can merger these two object repository by

merge tool.Following is the procedure of merging:

1.Go to Resource->Object Repository Manger.2.Tools Object repository merge tool

3.Here you can provide two shared object repository's location and merge it.

To copy or move all of ur local objects to shared object repository do the following:1. Open the local object repository of the action whose objects u want to convert to shared.2. In the object repository window, file-->Export Local Objects3. Save the file with any file name with .tsr extension. (This will be ur shared object repository)

To check open Resources-->Object Repository Manager-->The file you saved with .tsr extension.

You will see all the same objects in non-editable format.

EXT.

.bdb is for the local respository and .tsr is shared repository...

* QTP Local Repository : .bdb ( berkely database)

* Shared Repository : .tsr ( test shared repository)

QTP automation Test Planning:

Hello Friends, Before starting any new project with QTP, Please keep in mind some points so that you can easily accomplish your automation project in

Page 3: Qtp Knowledge

minimum time and effort. Today I am going to share my practical experience in Automation project planning with QTP.

1 QTP Test Planning Before Recording:You can plan your QTP test in following ways but before that you must have Object repository concept clear in you mind:Way:1- If you have 4 automation developer than, you will have 4 QTP Test projects and in future you need to merge these 4 projects, so try to avoid this methodology because when you merge 4 QTP test projects there will be many objects that can conflict ( Object conflicts means same object name [with same or different properties] in two or more QTP test recorded on different webpages ) and  leads to re-recording and re-working stuffs.

Way:2- Maintain only one Shared object repository accross all QTP Test projects, the only drawback of this way is only one person can do a recording at a time so here all 4 developers will be dependent on each other. Once the recording of one developer is completed He/She can export all objects in shared object repository and then second developer can use that latest shared object repository and can go ahead with his recording stuffs and so on.

Way:3- If you want to avoid each other developers dependency and also If there are more developers than way-2 becomes difficult to manage. When any developers record the object using QTP, QTP automatically gives the object name here in this method developers need to re-name the object (Should be unique) in object repository and same in script thus you can avoid object conflics in future If you plan to merge all QTP Test in one QTP Test project.

2 Recording With QTP:While recording follow the steps you expect users to perform as they move within your webpage or application.If you are beginner in QTP visit here: QTP Scripts example for beginner

3 Enhance and Modifying your recorded script.

Add checkpoints to search for specific values of a page,text string,table or image.

You can create output values to retrieve data during run time. You can use regular expressions to increase the flexibility and can

avoid redundant script.

You can further enhance your test script with programming and conditional and loop statements(If Else...End If, For Loop..etc), which add logic to your test script.

Page 4: Qtp Knowledge

You divide your scripts in function and Subroutine so that your script will become more modular and generic.

If you want to perform basic operation like File,Folder delete,Create,copy etc. You can perform it through vbscripting. Visit File system object in QTP for more information.

4 Debugging your script with QTP.

Debug your test script to check that it operates smoothly and without interruption.You can check the value of variables at run time using debug viewer pane.The Debug Viewer pane contains the Watch, Variables, and Command tabs. Please look in to the QTP help for more information on debugging.

Once your script is developed and tested try to put it for regression test as much as you can, In this way you can make your script more stable and reliable. If you want to know more about QTP regression framework you can visit here and can modify the framework according to your requirement.

Please share your practical experience and thoughts so that we together can share our friends best knowledge in the automation test planning in QTP.