2. Descriptive Programming (DP)
OR is the simple and default way of object identification in QTP. Object Repository is a storage place of QTP, where properties and values of every object are stored. While you record on application, all the objects you click/interact, are stored in Object Repository.
Well, there might be many valid reason to do so. Think about a situation – you want to close all opened browser automatically before you start executing your script. Here OR will not help you to identify an object as it is not possible to store all the opened browser objects into OR. Make sense?
Here is the format/syntax of DP..
object’s Class Name(“property name:=property value”)
Exmp 1: webbutton(“Name:=Google Search”)
object’s Class Name = webbutton
property name = Name
property value = Google Search
Exmp 2:- Browser(“google”).page(“google”).webbutton(“name:=Google Search”,”type:= Submit”).click
In above statement, Browser(“google”) and page(“google”) are written using OR. And webbutton(“name:=Google Search”,”type:= Submit”) is written using DP.
Please note that we can write multiple set of properties and values in any DP statement.
Examples:
webbutton(“name:=Google Search”).click
webbutton(“name:=Google Search”,”type:= Submit”).click
webbutton(“name:=Google Search”,”type:= Submit”,”x:=301″).click
Correct: Browser(“google”).page(“google”).webbutton(“name:=Google Search”,”type:= Submit”).click
Incorrect: Browser(“name:=google”).page(“title:=google”).webbutton(“Google Search”).click
Okie!! Let me add one more point here. You can use variable also in Descriptive Programming (DP)!! Here we go…
Dim var_name
var_name = “Google Search”
webbutton(“name:=” & var_name).click
- Object Repository (OR) and Descriptive Programming (DP) are two ways, QTP uses to recognize the objects.
- These two ways are also known as Object Identification techniques.
- Descriptive Programming (DP) can be done in two ways – Static and Dynamic.
- A statement can be a combination of both OR and DP approach
- OR approach can be used only before DP. once you use DP in a statement, you can’t write OR after it.
- Properties and values of object for DP are captured using Object Spy.
- Variable also can be used for property values in DP.
This section was really useful.
@Anonymous
Thanks. Keep reading the good stuff!
Very Nice brief article about OR and DP.I wish you had provide some examples on DP's description object too…
Regards
Pankaj
@Pankaj
plz check all parts of the post and if still you have any question, plz let me know 🙂
Descriptive Programming – Part 1
Descriptive Programming – Part 2
Descriptive Programming – Part 3
Descriptive Programming – Part 4
Hi AbhiKansh Jain,can u give examlpes for Webtables in QTP
Which is best way to write script.ether DP or in OR?
generally mixed approach is most fruitful…
Hello Abhikansh,
You are doing a great job… Keep doing…!!
The reason why I choose DP is because I am so fed up with OR and doing 'existing call'.
I dont dont understand after the "page" part, the number just keep on increasing.
Ex.: Browser(“google”).page(“google_2”).
That is why I choose DP. But how far can I go with DP?
Hi Abhishek,
I have one question here……
Can you please let me know that how to recognize menu options in descriptive programming in qtp.
Can you please let me know how to write DP for below mentioned example i.e.
Window("Flight Reservation").WinMenu("Menu").Select "File;New Order"
Window("Flight Reservation").WinMenu("Menu").Select "Analysis;Reports…"
Thanks… Nice Info
Awesome 🙂
hi,
Can u tell any ecommerce project so that i can practice….
this is ramanjaneyulu from hyd i know the qtp and manual and db but how to prepare the resumes, how to attended the intertives if don't main pls help me this is my mail id ramanjaneyulu08@gmail.com
this is ramanjaneyulu from hyd i know the qtp and manual and db but how to prepare the resumes, how to attended the intertives if don't main pls help me this is my mail id ramanjaneyulu08@gmail.com
very nice
@ramanjaneyulu
Regarding resume, i'll say..
– Write only what you know
– whatever you write, you must know 🙂
Abhi,
Great Post, I have been using QTP for over 6 years but havent seen such a brief intro for OR and DP.
Thanks keep writing.
thanks all!
That was awesome tutorial. Thanks again.