Monday, 26 September 2011

Object repository FAQ


Question: Types of OR (Object repository)?
Answer: There are two types of object repository Per action repository and Shared repository
Per action repository
Shared repository
1.Saves in the action folder under test folder while saving a test
1. Saves in a separate folder other then test and we can it as follows .
Dim App
Set App = CreateObject("QuickTest.Application")
blnOR=App.Test.Actions(strActionName).ObjectRepositories.Find(ORPath)
2. We mainly use it for very small test
2.We mainly use it for big test where we have to interact with so many function or actions .
3.Extention is .mtr
3.Extention is .tsr .

Question 2: How to Merge OR.
Answer 2: We can merge OR as follows.
Navigate: Resources > Object repository manager
In object repository manager open Tool: > Object repository merge Tool


It will navigate to following screen.
Browse primary file and secondary file  and click OK

After merging it display a message like below:

We can select option from following as per the requirement:


After taking consideration all the conflict we can save the repository.



Question: How to compare two OR ?
Answer : We can compare OR as follows.
Navigate: Resources > Object repository manager
In object repository manager open Tool: > Object repository comparison Tool

It will navigate to following screen.
Browse primary file and secondary file and click OK

It will display result as follows

All the matched objects will get highlighted

Question: How to associate OR as per the action?
Answers: We can associate OR as per the actions as follows.
Navigate: resources > associate repositories

It will open new windows as 
In this window we can just select the repository and select the actions required in test with that repository.

                                                                                                                     


Monday, 19 September 2011

Type of recording available in QTP



Normal Recording: Normal recording option is available in QTP that captures all the mouse movements and keyboards operations on the basis of mandatory and assistive property of the objects available in QTP .

Low Level Recording : This is the form of recording which QTP does on the basis of mouse movement using coordinate on the screen .It works even though QTP is not able to identify the objects available on the screen .
Example :
Window("Mozilla Firefox").Activate
Window("Mozilla Firefox").WinObject("MozillaWindowClass").Click 607,248
Window("Mozilla Firefox").WinObject("MozillaWindowClass").Click 635,246
Window("Mozilla Firefox").WinObject("MozillaWindowClass_2").DblClick 326,292
Window("Mozilla Firefox").Activate

Helpful : When QTP is not able to identify the objects present on AUT   .
Drawback : It will not work in different resolution .

 Analog recording: Analog recording is done on the basis of mouse movement and generates only one line of code as follows, this one also works even though QTP is not able to idendify the object available on the screen.

Window("Windows Internet Explorer").RunAnalog "Track1"


Helpful : If we have to test a signature in AUT   .
Drawback : It will not work in different resolution .


Note # We can do Analog Recording and Low Level recording only when normal recording is already started.

Thursday, 1 September 2011

Descriptive Programming


Hi All,

  I this post I would like to discuss on descriptive programming one of the most important and complicated looking feature of QTP so I would like answer all the questions which arises when we start any new topic .
  
What is descriptive programming?

    As the name suggest it is some thing that is related to description then question comes into mind that description of what? So the answers is description of objects .As we know that QTP identifies the objects of AUT using the values of the properties available in object repository and in descriptive programming we give those values of objects with the help of descriptive programming so now there is no use to have those objects in OR .
We can provide the description of the objects in set line of codes and then QTP identifies that object in the behalf of the description.

When descriptive programming?

    As I have already told you that on using descriptive we can directly remove the OR stuff so basically we use descriptive programming when .

  •  We don’t want to use object repository at all.   
  •  Size of OR is too huge.   
  •  Objects and their properties are very stable. 


How to use descriptive programming?

  We use descriptive programming using two ways. 

  • String argument to access the objects.   
  •  Create object with the collection of their properties.


Step 1:  First of all we should identify the object of which description we want to create.
Step 2:  Now select that Object using Object Spy for Example if we have spy this edit box it will look like this.



                                              For browser:                              For page:                             


 Step 3: Then we have to identify the properties and its values because now we have to identify the object at run time with the help of giving the name of the object in the code itself.
e.g. for browser if we se title property is having value as “Google – Window Internet “
So reach to that browser we have write as browser(title:= Google – Window Internet) never forget to put “:=” colon then equal to sign .
 In the same manner we have to identify the page property and its value ,be very careful while selecting the property because it has to unique as compare to other object.

The above one was string format now if we talk about the (collection of their properties) we need to define a description class .

Set desc = description.Create
desc("micclass").value = "Browser"
desc("title").value="Google - Windows Internet Explorer*"

Example 1 : = This very common question in interview “Count the Number of links in a given page using DP”



Close 3rd  Open browser
Browser("CreationTime:=2").close
Since CreationTime starts from 0 and you very well manipulate these questions into many more new questions .