I am experimenting with using QTP for some webapp ui automation testing and I was wondering how people usually write their QTP tests. Do you use the object map, descriptive programming, a combination or some other way all together? Any little code example would be appreciated, Thank you
asked Dec 16, 2009 at 18:14 Josh Harris Josh Harris 177 4 4 silver badges 15 15 bronze badgesHere's my suggestion.
1) Build your test automation requirements matrix. You can use samples from my blog
3) Write your testing scripts according to the approach you chose
Note. QTP Repository way or Descriptive Programming belong to GUI recognition part of front-end functional test automation. They matter in terms of robustness and maintenance. Technically, it's nearly the same. In both cases you should understand GUI recognition concept well, or you will have problems no matter the approach.
A good framework should support both GUI-mapped and descriptive programming notations by operating at object reference level. I.e. you should keep object recognition and object interaction tasks separate.
Note that depending on context Descriptive Programming notation may slowdown performance of your scripts and it always demands extra maintenance effort while in other cases using Object Repositories only may lead to unwanted duplication of objects' descriptions or it may limit recognition of dynamically changing GUI.
I illustrate some points made above in the following article: A little QTP performance test: Object Repository vs. Descriptive Programming
Straight code examples (for a practical automation I recommend GUI Function Wrapping).
Descriptive programming - addressing objects by physical description properties.
Dim sProfile sProfile = "Guest" Set objWebParent = Browser("title:=Select Profile").Page("title:=Select Profile") Set objWebObject = objWebParent.Link("text: Select Profile").Page("Select Profile").Link("Guest").Click
answered Dec 17, 2009 at 15:04
Albert Gareev Albert Gareev
790 6 6 silver badges 13 13 bronze badges
Thank you for your post Albert. From what I gathered you would suggest a hybrid approach of Object Map with descriptive programming when necessary? Nice site by the way, I would have to say robustness is the most annoying part of ui automation.
Commented Dec 17, 2009 at 18:06Hi Josh. Yes, I would strongly recommend having library functions that receive object reference as a parameter. When calling from outside you'll have a freedom defining objects both as mapped and through descriptions. Yes, making your scripts robust is really challenging but it should be a part of the framework and not in the test logic.
Commented Dec 21, 2009 at 21:09The "automation approach" link in Albert's post is one of the best summaries I have seen regarding this topic. Nice stuff.
Commented Jun 18, 2010 at 8:01If you design your Functions Library in a way that you have functions wrapping GUI functions, and those wrapper functions take each GUI object as parameter, than for those wrapper functions it is not important weather you pass object names from Object Repository, or instances of Description Objects. So with proper library design you can use both OR and DP.
Commented Jul 27, 2010 at 0:10I know I am late here, and you must already have what you are looking for, but I wanted to provide my inputs as well for anyone visiting this topic.
I generally never use OR, unless I encounter an environment where Descriptive Programming is a no-go. Just recently, I worked with a Mainframe Front-End GUI application that has absolutely no naming convention for objects. If you choose to use Descriptive Programming with such an application, the only way to work with its objects would be through Index or Location Ordinal Identifiers, which is not the best course of action considering 100's of objects in each pane.
So, the answer to your question really depending upon the environment and your experience with OR and DP. Most people I have worked with at my job, and on online communities prefer to work with Descriptive Programming whenever its feasible. However, I have also seen people work wonders with OR.
I have a few code samples, but, unfortunately, they are deal with Descriptive Programming. For instance, the following article talks about creating modular VBScript classes to divide application's functionality into small manageable components:
Similarly, this article shows how Descriptive Programming can be used to verify multiple properties of target objects through a single block of code:
Also, a demo framework is also available for you to view here:
The framework is built completely on the principles of Descriptive Programming, but in the next release, some functionality will be added that will enable users to work with ORs as well.
(Thanks for linking to the original articles, Motti)