Descriptive Programming (DP) vs Object Repository (OR)

by Anshoo Arora ON August 10, 2009 · Posted In All, QTP, QTP/DP · 58 comments

Comparison
Creative Commons License photo credit: dkalo

DP vs OR: Which is better?

This has been a never ending debate and if you follow QTP forums, you will see a thread pop-up every few days. Most commonly, the OP is trying to inquire which one would be better (vague?), which one would require less maintenance time, which one is more user-friendly, which has the performance upside, which one will my boss admire more etc.

The answer isn’t simple.

That’s why this has been a never ending debate :)

I do not guarantee that after reading this post, you will have an answer, but I am sure with some planning, you will be able to make up your mind as to which one would be the better alternative in the long run.

1. In Expert View, DP and OR statements are written in the following manner:

'OR
Browser( "Google" ).Page( "Google" ).WebEdit( "q" ).Set "Google Search"
 
'DP
Browser( "title:=Google" ).Page( "title:=Google" ).WebEdit( "name:=q" ).Set "Google Search"

With DP, the properties are written with their corresponding values. OR, on the other hand, shows only a logical description of the object.

2. A DP parent will only recognize a child that has DP style layout. In other words, you CANNOT add a child to a DP parent that has its properties stored in the OR. Example:

'Will not work: Browser is DP whereas Page and WebEdit are OR
Browser( "title:=Google" ).Page( "Google" ).WebEdit( "q" ).Set "Google Search"
 
'Will not work: Browser and Page are DP whereas WebEdit is OR
Browser( "title:=Google" ).Page( "title:=Google" ).WebEdit( "q" ).Set "Google Search"

However, an OR parent will recognize both OR and DP style children:

'Will work: Browser is OR whereas Page and WebEdit are DP
Browser( "Google" ).Page( "title:=Google" ).WebEdit( "name:=q" ).Set "Google Search"
 
'Will work: Browser and Page are OR whereas WebEdit is DP
Browser( "Google" ).Page( "Google" ).WebEdit( "name:=q" ).Set "Google Search"

3. Writing good DP for Objects takes experience and skill. Even though DP has become extremely popular, improperly written DP can lead to performance issues, maintenance headaches etc. Its quite a different story with OR where you record the objects and QTP creates the hierarchy.

4. The user must be careful when using DP: it is case sensitive (except in the case of Web Applications). Do not confuse this with how VBScript works. If the value of a property ‘html id’ is ‘txtZip’ then it must be coded as ‘txtZip’, not ‘txtzip’ or ‘TXTZIP’. QTP will only find the object if the value is written exactly as in the Object Spy. Example (WebEdit’s name property is retrieved as ‘editNewName’):

'Correct description for WebEdit
Window("nativeclass:=Test").WinEdit( "name:=editNewName" ).Set "DP"
 
'Incorrect description for WebEdit
Window("nativeclass:=Test").WinEdit( "name:=editnewname" ).Set "DP"
 
'Incorrect description for WebEdit
Window("nativeclass:=Test").WinEdit( "name:=EDITNEWNAME").Set "DP"

5. Unlike OR, DP does not have auto-complete. All object descriptions must be coded out manually. This can be quite time consuming, and even frustrating for people who’re used to working with OR.

Object Repository Auto Complete Feature

6. Unlike OR’s ‘Highlight in Application’ feature, when searching for an object hierarchy written in DP, you must execute the line of code to locate the object in the application. Another way would be to keep a record of all objects, which can be quite tedious.

Object Repository Highlight in Application Feature

7. DP supports ChildObjects (to create the description object, you MUST use DP). Description object example:

Dim oDesc
 
Set oDesc = Description.Create
'Add a name property to the description
oDesc( "name" ).Value = "q"
'Add a html tag property to the description
oDesc( "html tag" ).Value = "INPUT"

8. On average, DP is slower than OR (note: on average!). With DP, QTP creates the an object from the provided hierarchy of DP and locates the object in the application before performing an event. Demo:

'OR: 9.74 seconds
For i = 0 to 99
	Browser("Google").Page("Google").WebEdit("q").Set "QTP"
Next
 
'DP: 14.64 seconds
For i = 0 to 99
	Browser("title:=Google").Page("title:=Google").WebEdit("name:=q").Set "QTP"
Next

9. OR has a GUI which makes is easy to understand object hierarchies and maintain objects. DP hierarchies are code statements. Example:

Object Repository Front End GUI

WhiteBox style DP

10. .Object is available to both DP and OR:

'OR
Browser("Google").Page("Google").WebEdit("q").Object.Value = "QTP"
 
'DP
Browser("title:=Google").Page("title:=Google").WebEdit("name:=q").Object.Value = "QTP"

11. Objects have logical names in OR which makes it easy to identify them. Sadly, DP doesn’t, since its based on principles of a white-box.

12. This is strictly for OR, but at times you will notice that when working with applications, objects are added as: WebEdit_1, WebEdit_2, WebEdit_3 … WebEdit_n and so on. This can be extremely cumbersome to deal with, and it takes quite long to rename all the objects in OR to give them meaningful names.

13. Code written with DP can be easily ported (copy/paste) onto other scripts or functions. With OR based scripts, a simple copy/paste will not result in a working script. All the repositories (local/shared) would have to be associated with the test to make it executable. Therefore, when creating test with many reusable components, its generally easier to work with DP in comparison to OR unless there is a comprehensive use of Shared Object Repositories [Credits: Yogindernath].

14. Object Repositories have capabilities to perform single-point maintenance, whereas with DP, during changes, all objects undergo manual updates. In situations where there are several changes in the AUT, OR can prove to be a better performer [Credits: Marc Miedemo].

15. Starting QTP 11.0, you can use Visual Relational Identifiers with OR.

This feature is not available with DP, but there are workarounds using anchors. Consider the code below where we can use the User Name anchor to set value in the adjacent textBox:

SystemUtil.Run "iexplore.exe", "http://newtours.demoaut.com/", "", "", 3
 
Set userName = Browser("title:=Welcome:.*").WebElement("innertext:=User Name:", "html tag:=FONT").Object
userName.parentNode.nextSibling.childNodes(0).value = "test"

16. With OR, it is possible to add an object while spying on it. Because DP is not a ‘repository’, this is not possible. However, with QTP 11, it is possible to copy/paste object properties to any document directly from Object Spy.

17. It is possible to use XPath and CSS selectors with both DP and OR. To supply an XPath identifier for OR, simply click the Add button in the Object Description section to add it. With DP, the syntax is:

Browser("title:=Welcome:.*").WebEdit("xpath:=//input[@name='userName']").Set "test"

If you feel I have missed something and must be added or corrected, please post a comment and I will update this post, giving full credit to you. Thanks :)

Subscribe to Relevant Codes (by Anshoo Arora)

Hello! We're always posting interesting articles on Relevant Codes. Why not subscribe so you don't miss out?

Leave a Comment

{ 57 comments… read them below or add one }

sreenu August 12, 2011 at 9:39 am

very nice notable issues….good work…

Reply

Ritesh Saw June 18, 2011 at 12:44 pm

Hi Anshoo,

I need your help to automate calender date pop up e.g. IRCTC.co.in using DP but QTP is not recognizing the object. Kindly give me DP script:
My script:
Browser(“title:=:: IRCTC :: – Plan My Travel”).Page(“title:=:: IRCTC :: – Plan My Travel”).WebElement(“outertext:=Date*”, “html tag:=TD”).Image(“file name:=cal_1.gif”, “alt:=Calender”,”html tag:=IMG”, “html id:=cal”).Click

Thanks,
Ritesh

Reply

Anshoo Arora June 24, 2011 at 11:13 am

Ritesh: try this:

Browser("title:=IRCTC").WebTable("html id:=outerTable").Link("innertext:=29").Click

Reply

sreenu August 12, 2011 at 9:35 am

you can try this

browser(“name:=:: IRCTC :: – Plan My Travel”).page(“micclass:=page”).image(“html id:=Cal”).Click

Reply

Sheetesh Kumar Rath May 14, 2012 at 1:03 am

Hi Ritesh,
Try to use space after every “=” sign. Also, if there any special character before and after “IRCTC”, then us can use “.*IRCTC.*”. For, WebElement(“outertext:=Date*”, “html tag:=TD”) , use “Date.*” instead of “Date*”.

Regards,
Sheetesh

Reply

chetan December 22, 2010 at 2:36 am

Hi Anshoo,

which script will be fast in execution : -
DP script or Object repository based script.

Taking in consideration that 70% object have one property description and 20% have two property description and 10% have three property description in DP based script.

And if DP is more fast can you suggest how to write effective DP and how much property we should describe in DP.

-Chetan

Reply

Anshoo Arora December 23, 2010 at 3:30 pm

I don’t think DP is faster in comparison to OR. It can be at times, but certainly not always. I use DP mostly because of flexibility.

Reply

Anand Tambey November 25, 2010 at 8:32 am

There is one more difference or advantages of 100% DP Code as backword and forward compatibility with QTP. Is it valid or there are any issues around it you had experienced?

Reply

Anshoo Arora December 5, 2010 at 9:47 pm

I think the same applies to OR, right?

Reply

Riju VK November 13, 2010 at 1:07 am

Hi Anshoo,

This is a superb article Anshoo and clears many doubts which I had before reading. Actually I am looking for some directions related to the Automation Framework that I am currently working on. We have more than 3000 test cases which have been automated, all using OR. We have 30 OR files while are created module-wise. We are also using HP BPT which is pretty recently introduced by HP. So all these 30 ORs are loaded by application area and it hampers the performance to a great extent.

What I understand from your article above is basically a combination of OR and DP may be best suited for a web application, in terms of maintainability, performance and robustness. Please give your comments on this.

We also need some help in deciding when should a component be created and what all functionality to be included in it. How generic it needs to be? For example Login and Menu Navigation are 2 types BPT components which accept parameters and are being re-used across test cases. Any thoughts?

Thanks in advance,
Riju VK

Reply

Anshoo Arora November 14, 2010 at 5:35 pm

Riju,

I try to use DP as frequently as possible, and most of my projects have been 100% DP. These decisions are generally dependent on the size/knowledge/background of the team – but if you’re the only one scripting the AUT, then you have the freedom to choose the approach that you like best :)

If there are multiple re-usable components, why not create functions for them and call them in your BPT components?

Reply

Rajendraprasad September 6, 2010 at 3:30 pm

Hi Anshoo…

Thanks very much… Very good Userful information on OR and DP.

Thanks,
Rajendra

Reply

Dev September 3, 2010 at 7:36 am

Very useful article, Anshoo thanks a lot for your effort,

Reply

Radha April 28, 2010 at 7:19 am

Hi Anshoo,

How do we build Object Repository when application is not yet ready for recording? Kindly guide.

Thanks,
Radha

Reply

Anshoo Arora April 28, 2010 at 1:43 pm

Hi Radha,

Haven’t done this before, and not sure what the possibilities to this are either. I have however been on projects where the application wasn’t fully developed and I was brought in to start automating it. Mainly, while I see the application, I develop all the generic components and try to find out the HTML of each page that has been created. With the HTML, I can at least chalk out all the objects and the process/logic my scripts will follow. Is this an interview question or are you facing such a scenario?

Reply

Puneet March 2, 2010 at 7:40 pm

Hi Anshoo,

General comments. After reading your posting between DP and OR, I believe that DP is more effective in maintaining the object within the scripts and don’t have to deal with to many lines of code based on the last response you indicated about With command which is very effective. I only use OR for checkpoints only.

Thanks
Puneet

Reply

Puneet March 1, 2010 at 6:55 pm

Hi Anshoo,

How can i use the sfwindow(title).sfwindow(title2) once and don’t have to repeat it all the time in all of the other objects. I am using DP in all my scripts, this save me less time to modify I needed to the main window.For example:

SfWindow(“title1).SfWindow(title2).vbedit(“title).click
SfWindow(“title1).SfWindow(title2).SwfButton(“title).click
SfWindow(“title1).SfWindow(title2).SwfButton(“title).click
SfWindow(“title1).SfWindow(title2).vbedit(“title).click
SfWindow(“title1).SfWindow(title2).vbedit(“title).click

Reply

Anshoo Arora March 2, 2010 at 4:26 pm

Puneet,

You can do so using With statements:

With SfWindow(“title1).SfWindow(title2)
    .vbedit(“title).click
    .SwfButton(“title).click
    .SwfButton(“title).click
    .vbedit(“title).click
    .vbedit(“title).click
End With

Reply

Peng March 1, 2010 at 2:59 pm

Hi Anshoo,

How to realize bitmap checkpoint using DP?

Thanks,
Peng

Reply

Anshoo Arora March 2, 2010 at 4:25 pm

Peng,

Unfortunately, creating a Bitmap CheckPoint is not possible with DP. It can only be done if your object is present in your Object Repository.

Reply

CK February 22, 2010 at 4:10 pm

i have a small question regarding the case sensitivity for descriptive programming.
My application has two Images and their outer html are same except one word :
1)

2)

I am trying to click on one of the Image using the descriptive programming but it is not working and not identify the object.
can you help me ?
How to turn off the case sensitivity on web application.

rc = Browser(“name:=Webtop”).Image(“outerhtml:=.*by District.*”).Exist
I am getting rc = false

Reply

CK February 22, 2010 at 4:11 pm

1) title=”WorkSpaces (by District)”
2) title=”WorkSpaces (by district)”

Reply

Anshoo Arora February 24, 2010 at 9:05 am

CK,

The thing about working with Web Applications is that the description are case-insensitive. I can think of 3 ways you can do this:

1. Use Index.

rc_1 = Browser("name:=Webtop").Image("outerhtml:=.*by District.*", "index:=0").Exist
rc_1 = Browser("name:=Webtop").Image("outerhtml:=.*by District.*", "index:=1").Exist

2. RegExp & ChildObjects

Set oRegExp = New RegExp
oRegExp.Pattern = "district"

Set oDesc = Description.Create
oDesc("micclass").Value = "Link"
oDesc("innertext").Value = ".*district.*"

iCnt = Browser("creationtime:=").Page("micclass:=Page").ChildObjects(oDesc).Count

For ix = 0 To iCnt - 1
	sInnerText = Browser("creationtime:=").Page("micclass:=Page").ChildObjects(oDesc)(ix).GetROProperty("innertext")

	Set oMatches = oRegExp.Execute(sInnerText)

	If oMatches.Count > 0 Then
		Browser("creationtime:=").Page("micclass:=Page").ChildObjects(oDesc)(ix).Click
		Exit For
	End If
Next

3. Custom Functions

Function RegexClick(Object, sClass, sText)
	Set oDesc = Description.Create
	oDesc("micclass").Value = sClass
	oDesc("innertext").Value = ".*" & sText & ".*"

	Set oBase = Object.ChildObjects(oDesc)

	For ix = 0 to oBase.Count - 1
		If InStr(1, oBase(ix).GetROProperty("innertext"), sText) Then
			oBase(ix).Highlight
		End If
	Next
End Function

RegexClick Browser("creationtime:=").Page("micclass:=Page"), "Link", "district"
RegexClick Browser("creationtime:=").Page("micclass:=Page"), "Link", "District"

I know these are not very elegant, but I will try to do some research on this topic and post my reply soon. This only happens in the Web Environment.

Reply

Clive Farrington December 2, 2009 at 5:46 pm

One way you can avoid the added maintenance issue when using DP is by setting up the mostly commonly used objects in an external vbs file as public variables, I use this for any objects which are used for navigation around the application such that if any of these change they can be modified in one location. Then for objects which are specific to the script use a local OR because the likelihood of these changing and maintenance needed is small.
I also prefer to keep one OR per test and deal with the maintenance work rather than share OR between different scripts/people on the team and risk one persons change breaking someone elses script, those type of interelated dependencies are just to hard to deal with.
e.g.

Public Dufile
Set Dufile = description.Create

Dufile("type").value = "file"
Dufile("name").value = "FILE"
Dufile("html tag").value = "INPUT"

and then reference them in your script.

I also stick to DP in my function libraries since they only require a change in one place.

Reply

Anshoo Arora December 3, 2009 at 10:27 am

Good suggestions, Clive.

I think a lot of the pitfalls we see and hear on online communities and otherwise is because of the decisions teams take without much knowledge of either DP or OR. I don’t see experienced users making the same mistakes, and that’s because they realize their team’s potential with the job at hand and which approach will work the best. I don’t use ORs at all, and my experience with them is very little to have an opinion that I would share with my readers, but its always good to hear when they share their knowledge and experience with me.

Thanks :)

Reply

Yogindernath October 30, 2009 at 4:48 am

Hello Anshoo,

Hope you are doing well my friend and I hope you remember me as well… I think you missed out a point in OR vs DP. The point is : We can copy and paste the DP code easily across scripts but the same is not possible with OR based code. We need to export the objects as .tsr file and re-import again to copy OR based code..

Hope you will update this post :)

Overall this is a fantastic article and once again I must say you are doing a fantastic job :)

Regards,
Yogindernath

Moderator of Software Testing Genius

Reply

Anshoo Arora October 30, 2009 at 8:41 am

Hi Yogindernath,

I hope you’ve been well.

I think you missed out a point in OR vs DP. The point is : We can copy and paste the DP code easily across scripts but the same is not possible with OR based code. We need to export the objects as .tsr file and re-import again to copy OR based code..

Excellent point. I did completely missed this point. Thanks for reading the article in such detail and spotting this exclusion. I will update the article tonight, citing this comment and giving full-credit to you. Thanks again. :)

Reply

Anshoo Arora November 30, 2009 at 8:09 pm

Thanks for your contribution Yogindernath. The article has been updated with #13.

Reply

saurabh October 3, 2009 at 1:57 am

Hello Anshoo,

I followed up the same, (1) I recorded opening the browser, nevigate http://www.yahoo.com and set DP in the search webedit. In expert view, I got recorded the minimum script:

Browser("Google").Page("Google").WebEdit("q").Set "DP"

Action Taken by me: I deleted all except ‘Browser(“Google”)’ and rewrite the DP for page & webedit. It is producing Run time error again.

Observation: Switched to OR, I found all the property values were appearing there (including browser, page, webedit)
The object for which I used DP (page, webedit), The related property values were already appearing in OR. Shall we remove other properties than browser property from the OR?

Reply

Anshoo Arora October 3, 2009 at 10:41 am

Hi Saurabh,

I think what you’ve done is absolutely correct, but not entirely sure why you’re facing this issue. It shouldn’t occur since all the steps you mentioned are perfect.

I recorded a video for you: Click here to view the video. This may be unnecessary, but I just wanted you to see the steps I followed to implement an OR Parent with DP Children.

I hope you will be able to resolve the issue after watching the video. If you have any confusions about it, please reply to this message and we’ll figure out another way to resolve it.

Reply

saurabh October 1, 2009 at 4:14 am

Once again a thorough explaination. you have done an excellent job.

Reply

Anshoo Arora October 1, 2009 at 6:38 pm

Thank you again, Saurabh. I’m glad you found this article useful.

Reply

alkaa October 1, 2009 at 4:10 am

Hi,

Here, in the points (4) & (7), you did use object descriptiong directly into the script sentance and in point 7 you did it saperately. Is it related to dynamic and static properties of the object can you provide me more details about that If I am correct?

Reply

Anshoo Arora October 1, 2009 at 6:38 pm

Yes, Alkaa, in #7, it has been done separately.

#7 is actually an example of a description object and its a key concept to Descriptive Programming. There is an article available on Relevant Codes on the usage and importance of creating Description Objects. You can find it here.

Reply

saurabh October 1, 2009 at 2:20 am

Hello Anshoo,

Thank you for your reply that is very workable. I found some other issue too while working on your above given work…
In expert view page, script for google search ‘webEdit’ appears with value q. Can you tell us Why is this ‘q’ here?

With reference to 2nd point:

Browser("Google").Page("title:=google").......

Here browser is OR, I went to Object repository and ‘create an object’. I chosen Two properties “name” and “title”.
Run time error is still generating. Shall we add any property and value under browser particularly in the case?
Am I doing something wrong? Please provide the common guidelines to allocate the property name and its
value for all majorly using components.
Last but not least kindly provide the facility to attach the document in comment section, so that we can explain better.

Thank you,

Reply

Anshoo Arora October 1, 2009 at 6:40 pm

Hi Saurabh,

Please see my notes below:

Can you tell us Why is this ‘q’ here?

If you use your QTP ObjectSpy and click on the WebEdit, you will notice that the value for name property is q. That is the reason why you see q there.

Browser(“Google”).Page(“title:=google”).
Here browser is OR

Try to record on a browser. When you do this, the Browser object will automatically be added to the OR. In steps:

1. Click Record
2. Open a new browser
3. Navigate to http://google.com
4. Set “DP” in the Search WebEdit
<5>. You will now have a few objects contained in your OR.

In Expert View, delete the descriptions so all you have is the following:

Browser("Google").

Now, add the below to it:

Page("micclass:=Page").WebEdit("name:=q").Set "DP is great"

Now, you should have a description that looks like:

Browser("Google").Page("micclass:=Page").WebEdit("name:=q").Set "DP is great"

Please let me know if it works for you. If not, we’ll try something else. :)

Reply

ganesh September 2, 2010 at 5:47 am

hi its very usefull to all lerners thanks

Reply

Ranjini November 16, 2009 at 11:54 am

Hi Anoosha,
Unfortunately i am unable to view the video as mentioned below,
i have done the same steps as u have mentioned and when i re-run it ends up with the below message
“Cannot find the “[ WebEdit ]” object’s parent “Google” (class Browser). Verify that parent properties match an object currently displayed in your application.”

Can u please expalain in detail abt the root cause?

Reply

Anshoo Arora November 16, 2009 at 12:07 pm

Hi Ranjini,

Before you can do so, you will have to add the Browser object in your object repository. If the browser object is not present in your OR, the above code will not work. If you would like to skip the step, and use a Programming Description, then the code will become:

Browser("title:=Google").Page("micclass:=Page").WebEdit("name:=q").Set "DP is great"

Reply

Anshoo Arora November 16, 2009 at 1:02 pm

Also, the below error message:

“Cannot find the “[ WebEdit ]” object’s parent “Google” (class Browser). Verify that parent properties match an object currently displayed in your application.”

This generally means that the parent of the WebEdit in our hierarchy, which in our case is the Browser, is not found. This error occurs mainly because the properties we have supplied are invalid, or the object does not exist. Because the description doesn’t suit our needs since the object was not loaded in the OR, you got that error. Once you add the object, or use a Programmatic Description for it, the error will go away.

Reply

Ranjini November 18, 2009 at 9:53 am

Hi Anshoo,
Actually i was trying as per the point 2 mentioned “OR parent will recognize both OR and DP style children”.
followed the steps as
1. Click Record
2. Open a new browser
3. Navigate to http://google.com
4. Set “Descriptive Prog” in the Search WebEdit
5. Removed the Child objects from the OR and kept the Browser alone in the OR , to check the OR Parents recognises the DP Childs
I have tried once again and it worked for me now :-) and now i am clear with this concepts
Thanks a lot for replying for each of us queries to make us understand.

Regards,
Ranjini

Reply

Ranjini November 18, 2009 at 9:54 am

Thank You

Reply

Anshoo Arora November 18, 2009 at 1:46 pm

Most welcome :)

Reply

Marc November 30, 2009 at 10:02 am

When copying OR-based code, all you need to do is associate the OR to the scripts the code is being copied to. No big deal. (The same of course applies if code is made reusable with functions, but that’s another topic.)
Besides that:
- the OR provides a single point of maintenance, whereas with DP every occurence of a changed object must be updated in the code.
- for performance and recognition issues: disable Smart Identification
- for recognition issues: add/edit identifying properties so only the intended object is recognized, and nothing else
- objects requiring multiple identifying properties quickly become unreadable in DP. In that case, description objects may help
- DP is very powerful for object which are not known in advance, eg. dynamically generated searchresults like arrays of radiobuttons, checkboxes, links, etc. By the way, this still can be done in an OR with .SetTOProperty

To summarized, I prefer a mix of both techniques:
- well setup OR’s speed up development, and allow for easy maintenance
- DP is useful for objects that are dynamically generated by the AUT, or large arrays of dynamic objects

Reply

Anshoo Arora November 30, 2009 at 1:45 pm

When copying OR-based code, all you need to do is associate the OR to the scripts the code is being copied to. No big deal.

Its a notable difference between them, nonetheless :)

the OR provides a single point of maintenance, whereas with DP every occurence of a changed object must be updated in the code.

I think this depends on what kind of repository you’re dealing with. If you have several local repositories, or per-action repositories, then you would have to update them all. I agree with your statement about DP. If I have your permission, could I use your finding in the article, citing your comment and giving full credit to you?

I appreciate your feedback, Marc. :)

Reply

Anshoo Arora November 30, 2009 at 8:14 pm

Thanks for your contribution, Marc. The post has been updated with #14.

Reply

Anonymous April 30, 2010 at 3:40 am

Hi Anshoo,

Thanks for quick reply. This actually i read somewhere that we can start developing OR even when application is not ready to test. So i was curious to know how to do this.
Can you give an example how excatly we can do this?

Thanks,
Radha

Reply

prashant.kashyap April 14, 2011 at 6:44 am

Hi Anshoo,

I am brought into start automation for a project which involves customizing the base product which is currently in build phase. I have planned to identify the objects that would remain unaffected upon customization of application pages. I have also planned to make re-usable actions for common navigational items and base features in the mean time till the build is available

Also, in order to avoid using html id’s or specific object properties of the application that may undergo changes upon customzation, I am planning to use as many descritions as possible . Am I following the correct approach? Please provide your suggestions on this.

Once the build is available for test, I have planned that if not many major issues are found in the buid, I will go ahead with automation during integration test phase in order to accomodate my test automation timelines. Am I planning correctly here? When do you recommend would be the ideal time to start scripting automation tests?

Reply

Anshoo Arora May 2, 2010 at 12:34 pm

Radha,

I have never attempted this before, and I’m not sure how useful or effective this approach would be. But, to create an OR with custom descriptions, you must first know the object schema of your application – which the developers can provide. However, these schema change quite frequently while the application is being initially developed, so you will have to keep track of what’s changing because the change can affect your objects in OR. The following menu can enable defining new objects in OR:

Open Object Repository -> Object -> Define New Object

Reply

Radha May 6, 2010 at 12:03 am

Hey Anshoo,
I too think this will not be very effective…. it requires lot of re-work like what you have mentioned. Thanks for explaining :)
I really appreciate.

Radha

Reply

Karloz November 16, 2010 at 4:22 pm

There is a way to compare bitmap checkpoint without OR

Reply

Anand Tambey December 6, 2010 at 1:42 am

Forward compatibility is supported by QTP, both OR & DP. But DP(100%) code only supports backword compatibility and code will be portable for all versions. The presentation of connectedtesting also speaks about same in pros slide, however what was your experience? I had 100% DP code,which works seamlessly in 9.5,10 and now 11 also.

Reply

Anshoo Arora December 19, 2010 at 7:16 pm

Anand,

I rarely (less than 1%) use OR, so my experience is really insufficient to speak considering all the possibilities I can consider for DP. Because I’ve primarily used DP, so far, I haven’t had any major problems that I can recall while upgrading versions. There have been some issues after moving to 10.0 from 9.5, but they were all trivial. I’m currently using 11.0 and my old code works seamlessly still.

You make a good point though. I should include compatibility in the above bullets as well. Thank you!

Reply

Peng January 24, 2011 at 2:30 pm

Hi,

How to do this? can you please explain? thanks in advance.

Reply

Ritesh June 30, 2011 at 11:30 am

Hi Anshoo,
Thanks for the reply and notice you took . I tried your code, but it’s showing errore.g. Can’t find “[Link] object;s parent[webtable]” (class Web Table)
I am giving whole script. Please help me to automate this particular things since it’s really challanging for me.

SystemUtil.Run "iexplore.exe", "https:\\irctc.co.in"
wait 12
Browser("title:=IRCTC Online Passenger Reservation System").Page("title:=IRCTC Online Passenger Reservation System").WebEdit("name:=userName", "html tag:=INPUT").Set "riteshsaw"
Browser("title:=IRCTC Online Passenger Reservation System").Page("title:=IRCTC Online Passenger Reservation System").WebEdit("name:=password", "html tag:=INPUT").SetSecure "password"
Browser("title:=IRCTC Online Passenger Reservation System").Page("title:=IRCTC Online Passenger Reservation System").WebButton("name:=Login").Click

Wait 1
Browser("title:=:: IRCTC :: - Plan My Travel").Page("title:=:: IRCTC :: - Plan My Travel").Sync
Browser("title:=:: IRCTC :: - Plan My Travel").Page("title:=:: IRCTC :: - Plan My Travel").WebEdit("name:=stationFrom").Set "NDLS"
Browser("title:=:: IRCTC :: - Plan My Travel").Page("title:=:: IRCTC :: - Plan My Travel").WebEdit("name:=stationTo").Set "JAT"
Browser("title:=:: IRCTC :: - Plan My Travel").WebTable("html id:=outerTable").Link("innertext:=29").Click

Browser("title:=:: IRCTC :: - Plan My Travel").Page("title:=:: IRCTC :: - Plan My Travel").Link("innertext:=21","html tag:=A").Click
Browser("title:=:: IRCTC :: - Plan My Travel").Page("title:=:: IRCTC :: - Plan My Travel").WebList("name:=ticktTtype", "html tag:=SELECT").Select "e-ticket"
Browser("title:=:: IRCTC :: - Plan My Travel").Page("title:=:: IRCTC :: - Plan My Travel").WebList("name:=quota", "html tag:=SELECT").Select "General"
Browser("title:=:: IRCTC :: - Plan My Travel").Page("title:=:: IRCTC :: - Plan My Travel").WebButton("name:=FindTrains").Click

Thanks in Advance
Ritesh

Reply

Anshoo Arora June 30, 2011 at 11:46 pm

Ritesh,

there you go:


SystemUtil.Run "iexplore.exe", "https://irctc.co.in"

With Browser("title:=.*IRCTC.*")
	If .Exist(30) Then
		.WebEdit("name:=userName").Set "riteshsaw"
		.WebEdit("name:=password").SetSecure "myPassword"
		.WebButton("name:=Login").Click

		.Sync

		If .WebEdit("name:=stationFrom").Exist(15) Then
			.WebEdit("name:=stationFrom").Set "NDLS"
			.WebEdit("name:=stationTo").Set "JAT"
			.Image("html id:=cal").Click
			.Link("innertext:=29", "index:=0").Click
			.Link("innertext:=21", "index:=1").Click
			.WebList("name:=ticketType").Select "e-ticket"
			.WebList("name:=quota").Select "General"
			.WebButton("name:=Find Trains").Click
		End If

		.Sync
	End If
End With

Reply

Ritesh July 2, 2011 at 11:01 am

Thanks Anshoo,
It’s great pleasure to me to say that your code reaaly worked so smoothly! I don’t know how to thank you, but please accept my heartiest and warm regards to you. Once again thanks. Now i must be in regular conatct with you if i want to learn expertise in QTP:)

Ritesh

Reply

{ 1 trackback }

Previous post:

Next post: