Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
static vs dynamic dscritve programing
#1
Solved: 11 Years, 4 Months ago
hi ,

to set a editBox :

static descriptive approach :-
Code:
window("Title:=Login").WinEdit("AttachedText:=Agent Name:","height:=20","width:=119" ).Set "abcd"

dynamic descriptive approach :-
Code:
Set myvar= description.Create()
myvar("AttachedText").value="Agent Name:"
myvar("height").value=20
myvar("width").value=119
window("Title:=Login").WinEdit(myvar ).Set "abcd"
I have read a article that the " Dynamic descriptive prog provides more power, efficiency, and flexibility".
but i dont understand this concept that how it is flexible,powerful & efficient . As we can see that in both the cases we are using the same number of properties to identfy a object


please help me in undestanding this concept
Reply
#2
Solved: 11 Years, 4 Months ago
Hi,

Static Descriptive programming: This is quick and short but it may cause the problem when your scripts are maturing at a level that you might require same object in different screen of the same test script......This syntax has the benefit of being shot and quick, but may cause problems if we’ll use the object again somewhere else. In this case we’ll have to rewrite the all the description strings, making the code less readable, and harder to maintain (i.e., if one of the properties were to change, we’ll be forced to make several repairs in different places throughout the code).

Dynamic Descriptive Programming: The main reason I guess this is used is for sometime an object will appear under a different parent each time (e.g. – a pop-up which appears under the initiating sub-window). In some applications, the only way to work with such objects is with DP. Apart from that there are some dynamic objects like list box for which content keeps on changing so at that moment this dynamic descriptive will be more efficient and flexible enough.

one more advantage is According to this, instead of working with a single object at a time, we can gather all the objects in an array which answer to our identification properties, and work with them as a collection, and resize the array whenever we need it.

Hope this clears your query.
Reply
#3
Solved: 11 Years, 4 Months ago
Sorry; but still i didnt get the concept clear
Reply
#4
Solved: 11 Years, 4 Months ago
Hi,


Let me attempt to explain further.

In static descriptive programming: we provide state of values and propertiesthat describes the object directly


Code:
window("Title:=Login").WinEdit("AttachedText:=Agent Name:","height:=20","width:=119" ).Set "abcd"

In the code above for placing abcd on all the winedit box you require more number of statements. What if in future you get more than the specified number of winedit box, one needs to write more statements to accomodate it. while in dynamic descriptive programming you will be having all the collection of winedit box in an array and you can use it in some kind of loop, the best example could be a winlist or dropdown box object.

In Dynamic descriptive programming: We provide collection of properties and values to desscription of the object and then we provide other statements in support of the object collection e.g. .Childobjects
Moreover an object and its property contains name of the object and value of the property of the object. in return it provides a collection of object having same properties. Once the object property is created we can have add, remove values to or from the object property can be entered during run time


Hope this helps.
Reply
#5
Solved: 11 Years, 4 Months ago
Hi Ramesh
I would like to try to explain this with an example
Say you have a page in which there are multiple Submit buttons
if you want to click each button one by one.
In that case if you use static DP then you will have to uniquely identify each button and then click each one which will take you to the repeateative steps
but using Dynamic DP you can do this easily using childobjects and a loop.
Code:
static
Browser("micclass:=Browser").Page("micclass:=Page").WebButton("micclass:=Button", "name:=Submit", "index:=1").Click
Browser("micclass:=Browser").Page("micclass:=Page").WebButton("micclass:=Button", "name:=Submit", "index:=2").Click

Dynamic

Set oButton = Description.Create
oButton("micclass").value = "Button"
oButton("name").value = "Submit"
set oButtons=browser("micclass:=Browser").page("micclass:=Page").ChildObjects(oButton)
For cnt=0 to oButtons.count-1
oButtons(cnt).Click
Next
I must say here that there is no rule that we have to use static or dynamic. we should always decide this based on the situation we are in.
hope I am able to clarify the point to you.

Reply
#6
Solved: 11 Years, 4 Months ago
Hi
Great explnation from u all
I could understand the examples mentioned
So we can say : like the biggest advantage is to get rid of multiple statements using dynamic DP

Thanks
Ramesh Tahiliani
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to control WAIT time with STATIC variable? chong67 3 4,002 06-22-2012, 10:38 AM
Last Post: sshukla12
  Object Repository and Discriptive Programing combination raaj123 1 2,585 05-22-2012, 08:32 PM
Last Post: Ankesh
  descript programing rjkmr.aiht 1 2,240 04-13-2012, 05:47 PM
Last Post: vinod123
  How to write the desriptive programing for gmail signin and signout shwetha_m 2 4,049 02-01-2012, 10:45 AM
Last Post: shwetha_m
  Automating/Testing - static and dynamic text in PDF Sravs7 0 1,817 10-24-2009, 07:47 AM
Last Post: Sravs7

Forum Jump:


Users browsing this thread: 4 Guest(s)