Sunday, 24 January 2016

QTP - 38 - Visual Relation Identifier in QTP !

As the name says, Visual relation identifier is a method to identify the object based on the neighbour objects. It works on the properties of the objects which are near to them. This feature is found very useful in few of the cases. If we take the example of webTable class in web based applications , it comes out to be the best feature. We can define the visual relationship identifiers, which can be set in both local and shared object repositories.

We can use VRI in both the ways that is descriptive programming and through configuring QTP manually.


->Through Descriptive Programming : 
Set rc = VisualRelations.Create
Set relation = rc.Add
relation.relatedobjectpath = "Browser(""micclass:=Browser"").Page(""micclass:=Page"").WebElement(""innertext:=Art"",""html tag:=LABEL"",""index:=0"")"
relation.relativeposition = micRelRight
relation.setargument micrelinline, True

Set des=Description.Create
des.Add "micclass","WebCheckBox"
des.Add "visual relations",rc

Browser("micclass:=Browser").Page("micclass:=Page").WebCheckbox(des).highlight
Set relation = Nothing
Set rc=Nothing

-> Through configuring in QTP manually : 

 In the QTP object repository click to on the visual identifier setting’s click to add
On the Visual Relation Identifier screen click on the + plus sign under the preview button:
Point to the object you want to use to help QTP identify the field you need to recognize
Point to that object in relation to which you want to define a object through VRI. 
Three Visual Relation Identifier detail options:
When you bring up the Visual Relation Identifier you’ll have three main categories (under Relation Details) to choose from: Horizontal, Vertical and Distance and Hierarchy.

Hortizontal – Enables you to tell QTP to id objects according to their hortizontal location in relation to the field to be indentified. You’ll have two options (Left and Right)
and an In line (horizontal) checkbox option. 

Vertical – Enables QTP to find related objects based on their vertical location relative to the object you want to identify. It also has two options (Above and Below) and a In Line (vertical) checkbox option.


Distance and Hierarchy – Enables QTP to find related objects based on their distance to the location of the object you want to identify. It has four options: Closest on the X-axis, Closest o n the Y-axis, Closest on both axes and Contains. 



Some Important points to remember about visual relation identifier are:

1. Visual relation identifier are taken into consideration if object is not uniquely identified using the object identification Properties(SI ,Ordinal Identifier ,etc).
2. Visual relation identifier have preference on smart identification for object recognition.
3. Ordinal Identifiers are ignored if visual relation identifier is defined for an object.
4. Visual Relation identifier are created for an object based on relative position of other stable object, i.e. objects existing left, right, top , bottom relative to object to be identified can be used for relative identifier.
5. Relative Objects should exist in object repository before a relation can be created if we are not using DP.
6. This is used to filter in case of multiple objects in the application matching object definition but are placed relative to other object in application.
7. If no objects in the application match the test object’s description properties, then the visual relation identifier you defined is ignored.
8. Visual relation identifiers are not supported for WebService test objects.

QTP - 37 - Shortcuts of QTP !

New Test : Ctrl + N
New Business Component : Ctrl + Shift + N
Function Library : Alt + Shift + N
Application area : Ctrl + Alt + N
Open Test : Ctrl + O
Open Business Component : Ctrl + Shift + O
Open Function Library : Alt + Shift + O
Open Application area : Ctrl + Alt + O
Add new Test : Ctrl + Shift + T
Add new Business Component : Ctrl + Shift + B
Add new Application area : Ctrl + Shift + A
Add Existing Test : Ctrl + Alt + T
Add Existing Business Component : Ctrl + Alt + B
Add Existing Application area : Ctrl + Alt + A
Close: Ctrl + F4
Close Solution : Ctrl + Shift + F4
Save Test : Ctrl + S
Save All : Ctrl + Shift + S
Undo Changes : Ctrl + Z
Redo Changes : Ctrl + Y
Cut : Ctrl + x
Copy : Ctrl + C
Paste : Ctrl + V
Comment : Ctrl + M
Uncomment : Ctrl + Shift + M
Indent : Tab
Outdent : Shift + tab
Complete word : Ctrl + Space
Argument Info : Ctrl + Shift + Space
Apply “With” to the script : Ctrl + W
Remove “With” : Ctrl + Shift + W
View Solution Explorer : Ctrl + Alt + L
View Toolbox : Ctrl + Alt + X
View Properties : Ctrl + Alt + P
View Data : Ctrl + Alt + D
View Output : Ctrl + Alt + U
View Errors : Ctrl + Alt + E
View Tasks : Ctrl + Alt + K
Find : Ctrl + F
Find Next : F6
Replace : Ctrl + H
Incremental Search : Ctrl + E
Reverse Incremental Search : Ctrl + Shift + E
Toggle Bookmarks : Ctrl + B
Goto Matching Brace : Ctrl + M
Goto Location : Ctrl + G
Step Generator : F7
Check Syntax : Ctrl + F7
Record : F3
Stop Run/Recording : F4
Analog Recording : Ctrl + F3
Low Level Recording : Shift + F3

Most frequently used

Run : F5
Run now : Shift + F5
Stop : F4
Run from step : Ctrl + F5
Step Into : F11
Step Over : F10
Step Out : Shift + F10
Insert Breakpoint : F9
Remove Breakpoint : Ctrl + F9
Clear All Breakpoints : Shift + Ctrl + F9
Open Object Repository : Ctrl + R
ALM Connection : Ctrl + Q
Next Window : Ctrl + Tab
Previous Window : Ctrl + Shift + Tab
Help : F1

QTP - 36 - Version control with QTP !

Version control is used to trace, manage and control the history of each software change. It includes all the changes like what was done, who did it and also the reasons. It lets you to track the changes in the scripts over a period of time. We can also look back and see that what changes were done at a particular period of time and who did it. We can also revert our scripts to the older versions if needed. It allows three main things in the software that is  reversibility , concurrency and annotation. So lets talk about version control in QTP.

Reversibility -  the ability to back up to a saved, known-good state when you discover that some modification you did was a mistake or a bad idea

Concurrency- the ability to have many people modifying the same collection of code or documents knowing that conflicting modifications can be detected and resolved.

Annotation means  attaching explanatory comments about the intention behind each change to it and a record of who was responsible for each change.

For version control with QTP we need to have licenced tool QC or ALM. We need to integrate the ALM with the QTP. Once the version control is configured then all your ALM assets (including resources) cannot be modified anymore without checking them out. Each time we need to check out and make our changes and check back in to view our changes.
QTP recognizes the version control being enabled, and behaves accordingly (requires (and supports) checkout before modify, and so on).

Note : Always the latest version of Asset is checked out to a user