Saturday 18 August 2012

Object Repository & Descriptive Programming

What is an Object Repository?
As the name Suggest Object Repository (OR in Short) is place where QTP Test Objects properties and its values are stored.

Conceptually if we want to perform a task on any Objects like WebButton, WebEdit, WinEdit etc. what we look for? Naturally the Object's available methods/functions/sub on which we need to perform the task!

Now, how do you know or how do you identify whether you are clicking the right button or entering string in right TextBox (WinEdit/WebEdit)? So, what do you look for the right Button or TextBox?

Your answer maybe like
-The look and feel of Object should be like button
-It should contain text on button
-And if their are two button with same name then in which context the button is present, I shall click that one. Example button name is "Submit" context may be
  1. Click Submit to update record 
  2. Click Submit to Add the record

So ultimately what were you doing? Identifying Objects by their properties, right? This is how QTP does the same to identify Objects.

For in depth understanding with illustrations on how QTP Identify Objects, click here.

Also have a look at Object Repository GUI in QTP and Descriptive Programming in QTP

Now, lets look at below screenshot of OR & DP Code, try to catch the difference

Look at the highlighted part. You will understand the commonality or what is the basic thing QTP works with, i.e. Properties.

I was just wondering how could OR based Code is associated with Object Repository, I just opened the Script.mts file in notepad and then. . .






See the highlighted part, now you can imagine how QTP IDE has been designed and how could QTP OR and DP based code works. ;-)
Hope you are able to understand OR and DP!

I don't know what these highlighted part are, otherwise I could have been in Mercury inc. ;-)



-Pankaj Dhapola
Think on it!!!