Hi , we use descriptive programming when we deal with dynamic object of say link or button.
The main reason is that while using descriptive programming all objects of same type is stored in the form of array.This is the job of childobject it returns multiple instance of same object which can be stored in arrays. Regards Naveen ============================================================================== On Wed, Aug 3, 2011 at 11:54 AM, Firoz <[email protected]> wrote: > thanks Thanigai > > > On Aug 1, 9:54 am, Thanigai kumaran <[email protected]> wrote: > > Hi, > > > > Description Object also do the same thing as static way do but there are > > some differences. > > > > - Description Object stores the properties and values of a particular > > object in an instance of that object. So it become easy to use it in > the > > statement. > > - Description Object are used with ChildObjects (very useful method) > of > > QTP. > > - It's more useful if you are using multiple properties to identify > > object. As you will use only instance name in your statement, your > code > > looks more organized. > > - It's very handy if you are using index property for object > > identification (we'll discuss later) > > > > Look into following line. It is DP statement, written by Static approach > > > > > Browser(“name:=myBro”).page(“title:=myPage”).webbutton(“name:=Enter”,”type:= > > Submit”).click > > > > Now let's write the same using Dynamic approach. We see that there are 3 > > objects in above statement i.e. Browser, Page, webbutton. > > > > Now, first we need to create empty description objects. We'll create 3 > > object (1 for each object) > > > > Dim oBrowser, oPage, oButton ' declaration is not mandatory but good > > practice! > > > > Set oBrowser = Description.Create > > Set oPage = Description.Create > > Set oButton = Description.Create > > > > Now we'll add identification properties & values to these objects. > > > > oBrowser("name").value = "myBro" > > > > oPage("title").value = "myPage" > > > > oButton("name").value = "Enter" > > oButton("type").value = "Submit" > > oButton("x").value = "301" > > > > And that's it! Our objects are now ready to use now. So, here we go... > > > > Browser(oBrowser).page(oPage).webbutton(oButton).click > > > > As we can see, we will write only the instance name (oButton) instead of > > all properties and values in statement. > > > > Explore the following code to make the things clear... > > > > 1. Browser("myBro”).page(“myPage”).webbutton(“Enter”).click - OR > > approach > > > > 2. > Browser(“name:=myBro”).page(“title:=myPage”).webbutton(“name:=Enter”,”type:= > > Submit”).click - Static DP. > > > > 3. Browser(oBrowser).page(oPage).webbutton(oButton).click - Dynamic DP > > > > First statement is written using OR approach. For this, objects must be > > stored in Object Repository. > > > > Second statement is written using Static DP. All the properties are given > > directly in the code. Convenient!! > > > > Third statement is written using Dynamic DP. You need to create a > > description for every object. > > > > Please note that any statement can be written by combining all three ways > > > > Browser("myBro").page(“title:=myPage”).webbutton(oButton).click > > > > In above statement, we have used all 3 ways.. > > > > Browser - Object Repository > > Page - Static DP > > webbutton - Dynamic DP > > > > -- > > * > > Thanks & Regards > > **Thanigai Kumaran* > > > > On Mon, Aug 1, 2011 at 9:33 AM, Firoz <[email protected]> wrote: > > > I folks, > > > i new to qtp. advice me why and when we use this code "set > > > obj=description.create" > > > > > Thanks in advance > > > > > -- > > > You received this message because you are subscribed to the Google > > > "QTP - HP Quick Test Professional - Automated Software Testing" > > > group. > > > To post to this group, send email to [email protected] > > > To unsubscribe from this group, send email to > > > [email protected] > > > For more options, visit this group at > > >http://groups.google.com/group/MercuryQTP?hl=en > > -- > You received this message because you are subscribed to the Google > "QTP - HP Quick Test Professional - Automated Software Testing" > group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/MercuryQTP?hl=en > -- Regards Naveeen Shrivastava Senior Automation Engineer Support For :- Logitech Inc. and Ford Location :- Gurgaon -- You received this message because you are subscribed to the Google "QTP - HP Quick Test Professional - Automated Software Testing" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/MercuryQTP?hl=en
