Sunday, June 6, 2010

Object Repository v/s Descriptive Programming

While automating the application the most common question is Should we use Object Repository or Descriptive Programming.

The answer is, It is completely dependent on the Application nature, size of the automation and the framework followed.

Lets assume there is an application where in around 100 dynamic pages are there. In them there are several GUI elements(objects) are there. But most of the objects(and their properties) are same across multiple pages. Like date fields, input fields and web tables. But page titles are different.

1)To automate this application If we go with OR approach we have to create a huge object repository and which intern occupies lot of memory and maintenance issues.

2)If per action is used huge effort goes in merging the object Repository.

3)If there are lot of dynamic objects for example when user logged in, the user id is displayed as link in the home page.

In the above scenarios Descriptive programming is the right approach.

Problems with Descriptive programming
1)If the descriptive objects are not created in a right approach it may result huge maintenance issue.
2)Script generation would take time as the Object repository is not available.

Some times due to framework limitations Descriptive programming cannot be used at that time the following ways can help to modify the objects in run time.

-> Use regular expression for the objects which are dynamic
-> Use SetToProperty to modify/add object property in run time.

We will discuss more about SetToProperty in another post.

The conclusion what I want to say is Object Repository or Descriptive programming both has their own pros/cons. As per the need one should choose the approach.

And at the same time both approaches can be used in automation of any application.

Using Descriptive Programming

-> Assume there is an object in a page the descriptive approach is
Browser("micClass:=Browser,title:=XXX").page("title:=xxx").webbutton("text:=xyz").set "abc"

The same also can be achieved
set obj_browser = description.create()
obj_browser("title").value = "XXX"

set obj_browser = description.create()
obj_browser("title").value = "xxx"

I will discuss more about descriptive programming in another post.

Feel free to contact me for any kind of queries mura.kunda@gmail.com