Sunday 21 October 2012

Architect Object Respository in your own way in Automation Framework

Object repository has been one of the most important aspects of framework development.


I am not going to show how you gonna add objects in QTP Object repository or use the object repository manager of QTP. Well you could find all those stuff very well over Internet.

I have seen some people Manipulating Object repository usage in QTP.

At a very basic level how do you understand Object repository existence, why their is a need of OR?

 To explain it in a simple manner, every Automation tool has its own architectural aspect to store Object properties or Object identifying criteria at a common place for usage while automation script run session.

 For example,
  • Object Repository in QTP
  • Object Map in RFT
  • Object Browser in Test Complete
I have seen people using QTP based Object repository, some building their own object repository! Of-course as I always say usage of every scenario has its own pros and cons.

Do you understand building their own object repository and not using QTP based Object repository?

I guess your next question is how is that so?

Just give more attention to above paragraph in bold letters.

When I say a place where object properties are stored, you can use an XML file, and excel file, a text file etc., Now the challenge is how you will use these files while in QTP run session.
You can place the description strings in these files and use some powerful Vb Script functions to build scripts


Just try to decode the below Image Illustration





Above illustration is very raw type of code, my aim behind showing this illustration is being an Automation Test Engineer cum developer you can tweak
the Object Repository usage in your script. Many ways can be developed to design architectural aspects. Of-course to master on you architectural skills you need experience.

Please note that I have purposely use the name of objects as such for better understanding.

Other Variation I see is below, I learned this technique from one my mentor, whom I regard as one the best minds I ever met.












So in Above illustration, you can observe how you can mimic an OR in QTP. Of-course many other ways have been developed.
Note that don't bother about the Hierarchy column as of now.
 

My main intention of displaying above different technique is to make you understand how you can design your OR. People of great minds have done this in many ways.

-Pankaj Dhapola
Let's Think on it