Understanding Object Repository

Object Repository is a centralized place for storing Properties of objects available in AUT (Application Under Test).

Why Centralized place? And, Why we should store the properties of objects available in AUT?

First, I will explain below things which will be helpful for understanding answers of above questions.

– All software applications and websites are getting developed using many different components or small units (e.g textbox control in vb, input tag in HTML, webbrowser contorl in .net) which can be called as Objects.

– Each object will be identified based on the object type. And also, each object will have its own properties (e.g name,title,caption,color,size) for helping to identify by each of them. And also, each object is having specified set of methods.

– Some of the properties can be changed during run-time. These are known as RO (Runtime object) properties. And some of them can not be changed. They are known as TO (Test Object) properties.

– You can use ObjectSpy available in QTP IDE to see the TO properties & methods and RO properties & methods of any object available in your application. (Make sure that required add-ins are available).



If you see TO and RO properties of many objects in different applications using ObjectSpy, you will be in a position to distinguish between TO and RO properties.

– Since TO properties are used for uniquely identifying any object, QTP will store only the TO properties of any object in the Object Repository.

– QTP will store TO properties of any object of AUT in Object repository as Name & Value pair. You can refer the below screenshot.

 


– The Objects stored in the Object repository(OR) are called as Test Objects. Actually it is just equivalent to the corresponding actual object in AUT.

– All the Test Objects that are stored in Object repository(OR) are arranged in a hierarchical structure. (e.g Browser->Page->webelement).

– QTP will store the TO properties of the Objects in many different ways.

  • One simple way is, while doing Recording the TO properties will be stored to the OR.
  • Second way is, TO properties can be stored by pointing the mouse cursor to required object in the AUT.
  • Another way is manually adding the TO properties of the objects to the OR.

– Note that QTP won’t store all the TO properties of the objects into the Object Repository. Only few properties will be stored to the OR, based on the setting done in Object Identification window. Refer the below screenshot. It can be opened from QTP IDE (Tools->Object Identification).


-Sometimes, QTP will store some additional properties such as index, location which are known as ordinal identifiers. Actually these properties won’t be available in the object of AUT. It will be created by QTP automatically to distinguish two objects which are having exactly same TO properties. (e.g Some forms in the web pages will be have two submit buttons, one at top and another at bottom. QTP can identify them only based on location or index).

-Note that even QTP is storing TO properties based on properties of object of AUT (i-e real object), there is no need for all the TO properties to be available in RO properties collection also. (ie) QTP can derive (i-e do some manipulation) to get some new TO properties from one or many RO properties.

-Script can get TO properties of Test Objects using methods such as getTOproperty and getTOproperties. Even, TO property of TestObject can be changed using setTOproperty. But anyway, it will be valid only till exiting the execution. After completing the execution it will resume the actual TO property stored in the OR.
During run-time we can get the property of the runtime object using getROproperty.

-Till this point we have seen about storing the Test Objects in Object Repository.
During Run mode, QTP will use these stored properties for comparing them with properties of actual objects of AUT to identify them.

– These Test objects can be represented in the script as ObjectType and Object name. (e.g Window(“Mozilla Firefox”).Activate).

– The object repository will support editing of properties of Test Object and new properties can also be added to them.

– The value for the properties of the Test Objects in OR need not be a constant. We can parameterize the values so that the TO property can be dynamically changed for each iteration of execution.

Now we can come to our Initial question. By storing properties in the centralized place, maintenance and updation of Test scripts can be easily done whenever there is a change in UI (User Interface) of the AUT.
Assume that Login screen is used in around 20 Test scripts. If the Page name of login screen in changed, we need not make any change in all these 20 Test scripts. Just changing the property of Test Object in OR is enough.

Clear understanding of Object Repository is essential if you are willing to use QTP extensively. Because we may face lot of difficulties/challenges while working with QTP. We should have clear knowledge in OR to face/solve them. Just Recording and Playback won’t help much. And also, Test Automation framework can be done very effectively only when you are familiar with understanding/handling of Object Repository.

Add-Ins in QTP

QTP supports various applications. But it won’t support all the applications by default. We need to load the corresponding add-in.

For example, if you are going to use QTP for a java application  you need to load java add-in.

This add-in concept will help QTP to support wide-range of applications without compromising the performance. And, it will improve object identification reliability.

Find below the Add-in list supported by QTP. If you know any other add-in available for QTP, you can mention it in the comments section.

In previous versions of QTP,  only few below mentioned add-ins will be available as default support.

Default Support
1. Standard Windows applications (invisible in the add-in manager)
2. Web objects / Applications
3. ActiveX controls
4. Visual Basic applications
In the previous versions, below add-ins should be loaded separately.
  Additional QuickTest add-ins Support
  1. Java
  2. Oracle
  3. SAP
  4. .NET
  5. Web Forms
  6. Siebel
  7. PeopleSoft
  8. Web services
  9 Main frame (Terminal Emulator)

You can select the required Add-ins while starting the QTP.

The below add-in manager screen will  appear when opening QTP. In the screen you can select the required add-ins using the check-box.

If you don’t want to see this add-in Manager again, you can uncheck the “Show on Startup” checkbox.

You won’t see this add-in Manager if you have unchecked “Show on Startup” checkbox.


To make it appear again, you need to check the “Display Add-in Manager on Startup” checkbox in the Options Dialog (Tools->Options).

Object Identification window (Tools->Object Identification…) will allow to handle properties of Test Object classes available in each loaded add-ins.

Whenever we open an existing Test,  we should load all the  add-ins used in that particular Test. Otherwise the below message will be shown.

“The following add-ins were associated with your test but are not currently loaded.


How to Learn QTP?

This chapter will give overview about learning QTP. You can read the details in coming chapters.

  • Begin with understanding the importance of software testing. You should learn software testing Concepts and you have to get clear understanding of functional and regression testing. You need to be bit familiar with Manual testing activities such as writing test cases, executing test cases and reporting the issues.
  • You have to understand the need and importance of software test automation before start learning QTP. Even having some basic knowledge about other Test automation tools such as Test Complete, Test Partner, SilkTest and Rational Robot will help to prepare Tool evaluation/selection document if you are going to use QTP as Test Automation Tool in your project.
  • Download some good QTP handbook from internet. And also, you can refer the Tutorial and other Help files installed with QTP installation.
  • Try to understand basics of Object repository. You will become more familiar with using Object Repository once after start working on QTP automation.
  • Familiarize yourself using QTP add-ins (i-e selecting/deselecting specific add-ins). Desired Add-ins can be selected while launching the QTP. Note that the add-ins enabled during recording should be enabled while running the script.
  • Understand the basic units such as Test, Actions and external vbscript in QTP by going thro’ the Help file and the Handbook document. Practice yourself by creating simple Test with one or two Actions.
  • Practice yourself by recording and playing some steps using the sample application (Flight booking Application).
  • Try to understand the need for having multiple Actions in a particular Test.
  • Practice yourself creating Actions and splitting the Actions. And also, understand the need for having external reusable actions, and practice yourself using “Call to Copy of Action” and “Call to Existing Action”.
  • Familiarize yourself with components such as Expert view, keyword view, Active Screen and Datatable.
  • Learn basics of vbscript by going thro’ the vbscript documentation available in QTP help file, and be familiar with syntax of frequently used vbscript functions such as mid, instr and split.
  • Do some practice to have clear understanding of relation between Test Objects stored in object repository and the Vbscript statements showing in the expert view. You can do it by changing name of Test Object in OR and see the name automatically got changed in the expert view statement. And also, you can try to add/remove/edit some properties of Test Object in the Object Repository.
  • Understand the relationship between the Keyword view and the expert view. Both views are having their own advantages. So try to use both views. For example, Keyword view will be useful for doing parameterization easily and expert view can be useful or rearranging the steps.
  • Learn different types of Checkpoints and use them in sample script developed using the sample application. Intentionally put wrong expected result in the checkpoints to see how the Test result will look when showing checkpoint failures.
  • Learn to use multiple Object repositories (both Local and Shared), and also practice to get clear understanding of merging of Object Repositories.
  • Learn Recovery Scenario to handle unexpected behavior of application.  For learning Recovery Scenario you may need some application which shows a pop-up window rarely/randomly. Mostly you can use a website which is having both https and http links. Security alert will be shown while moving from https pages to http pages.  You can use Recovery Scenario to handle this security alert window.
  • Read the Help file to get clear understanding of Datatable and parameterization. And also learn about Action iteration and Test iteration without any ambiguity. Practice it by creating Data Driven testing for simple login screen.
  • Start using Reporter.ReportEvent in the code to enhance the reporting of the results.
  • Use ObjectSpy to get familiar with finding both TO  properties and RO properties of the Object in the Application.
  • Learn to change Test Settings and the editor settings. Here you should have clear understanding of which setting is applicable for the particular Test and which setting is applicable for particular instance of QTP installation.
  • Understand the need for Synchronization and try to use different ways (use of sync(), waitproperty, and exist) to achieve it.
  • Practice to use Step Generator, Function Generator and Active Screen to speed up the automation script creation process. Effective use of Active Screen will help you to continue your QTP script development even when your application is not available.
  • Learn about different types of recording modes and understand the need for them. Low level recording may help you to handle some steps if the standard recording is not able to recognize the object using the currently available add-ins.
  • Learn how to create/use COM objects such instance of Internet Explorer browser and an instance of excel object. It will be very useful
  • Learn to use Debug feature effectively. For example, use of “Run from step” will significantly reduce the Debug time.
  • Understand the need for Regular expression and learn some frequently used regular expressions (e.g .*)
  • Learn about QTP automation framework creation, and try to create a framework best suitable for your needs.
  • Learn Automation Object Model and understand the need for them. For example Automation Object Model can be used for automatically start running QTP script at specified time.
  • Learn about best practices (e.g always using reference path) and coding standards.
  • Go thro’ the QTP forums (e.g www.sqaforums.com) and read the discussions to get familiar with QTP issues and solutions/workarounds.
  • Learn to connect with database table for checking the database content. For doing this either you can use Database Checkpoints or you can create script using createobject.
  • Learn basics of Descriptive programming (DP) which is the alternative for Object Repository (OR). Personally I won’t recommend to use DP because it will create maintenance problem. But anyway we need to learn Descriptive programming in case we need to update any existing DP code.
  • Learn to integrate with Quality Center (QC) which is Test Management Tool provided by HP. It was formerly known as “Test Director”. We can execute the scripts from QC itself. And, it is used  for maintaining Test cases and tracking Bug/Issues. Appropriate integration of QTP and QC will make Script maintenance, Execution and Reporting easy.

Introduction to QTP

Since QTP supports external add-ins, it can be used for automating testing of many different software applications and websites.
Some add-ins (e.g ActiveX, VisualBasic, Web) are built-in with QTP, and some other add-ins (e.g Java, .net, TE (terminal emulator))are external add-ins. External add-in means we need to install them separately once after installing QTP.

We have the option to load only the required add-ins when opening the QTP IDE. So, it will be helpful to improve the execution speed.

QTP will support Keyword Driven and Data Driven testing. We can create our own test automation framework (Hybrid framework) also based on our own requirements for test automation.

It is very important to understand how QTP works. Because it will help to learn any other features in QTP easily. And, it will help to design an effective automation framework. It will help to resolve any issue that may come across during automation script development and also during script execution.

It can be explained as below,

We know that every test case should have Test Steps and Expected Results.

As QTP is used for executing these test cases, QTP also should have a way for handling both Test Steps and Expected Results.

Handling Test Steps means, QTP should be capable of navigating any path/page in any website or in any software application.
For achieving this QTP should be able to recognize any control/object in any application/webpage which needs to be tested. For recognizing the object, it should know the properties of those objects beforehand. It is achieved by storing the properties of the objects in a centralized place known as Object Repository.

While running the test script, the objects in the application are identified/recognized by comparing the properties of the objects with the properties stored in the Object Repository. By doing this recognition, execution of Test Steps becomes possible.

QTP is having Datatables (similar to Excel sheet) for supporting execution for multiple iterations of same steps with different data. For example, assume that we need to execute two test cases, one for logging into a website using UPPER case username and another test case for logging into a website using lower case username.

For executing these two test cases, the steps will be same. The only difference is in the test data.

It can be easily done in QTP by putting these input usernames in Datatable and make the Script to execute it two times.

Next, we need to think about handling Expected Results. The purpose of testing is comparing the Actual result with the predefined Expected Results. It is achieved by using Checkpoints.

There are many checkpoints available in QTP. They are Standard Checkpoint, Text Checkpoint, Bitmap Checkpoint, Database Checkpoint, accessibility Checkpoint and XML Checkpoint.

Actually QTP can be used simply as Record and Play type tool for automation of simple steps on simple applications. But it should be extensively used by writing user defined functions and many other features to get more benefit from it.

QTP is not using any Proprietary Script. It uses commonly available VBscript. So, writing script will be simple. And also, vbscript is commonly used in many places such as Web development (ASP), and in windows administration works. So we can easily find lot of already available user-defined functions and help articles in the Internet.

And, QTP supports COM model. i-e Any methods and properties of any COM based application can be easily accessed from QTP. For example IE(Internet Explorer) and Excel Objects can be created within QTP script. i-e IE can be opened from QTP itself using vbscript and the script can navigate to the desired url and mostly it can do whatever we do manually in IE.
This COM support is applicable for QTP itself.
i-e Object of QTP itself can be created and handled. It is known as Automation Object Model. It will be useful for exporting the environment settings and also useful for scheduling the QTP scripts execution.

Basically, QTP is a functional/Regression testing tool. But it can be indirectly used for testing performance also. (i-e QTP scripts can be called from performance testing tool “Load Runner”). And, QTP is having limited performance testing options such as start and end transactions which will be helpful to find execution time for particular block of steps.

QTP can be closely integrated with the Test Management Tool Quality Center (QC). QC can be effectively used to run QTP scripts in multiple remote machines to complete execution of many test scripts in less time.

The user friendly IDE which has Keyword view, Expert view, Datatable, Active screen, object repository editor/manager, step generator, function generator, object highlight feature, intellisense, recovery scenario manager, update run feature and simple Test/Action handling features makes the Script developer/execution work easy. The IDE is integrated with useful tools such as ObjectSpy. The IDE has standard development features such as Debug

What is QTP?

Before learning about QTP, you should know about Software Testing.
Software Testing is the process of checking whether the Software or application is developed correctly according to the expected requirements.

Most of the IT departments in any Corporate will be having a separate division for doing Software Testing.

Software Testing is being outsourced to some third-party testing experts also.

Normally the Software Testing  Teams will be going thro’ the requirements and will test/check the Software product whether it is meeting the requirements.

The Software will be released to the public only after the Testing Team is satisfied with it.

The biggest challenge in Software Testing is  the “shortage of Time” .

i-e Testing should be done quickly in the short time available between the completion of Software development and the software release date.

Bugs/errors found in the application/software will add more complexity. Because the entire application should be tested again as regression testing once after making any corrections.

In summary, Software Testing should be done quickly in short time duration.

It is very difficulty to achieve this manually.

Automation tools and scripts will help to do to the testing quickly.

QTP is one of such Test Automation Tools. It is developed by Mercury Interactive in 2002. And, acquired by HP (Hewlett-Packard) in 2007.

Currently it supports Windows Operating Environment only. (Let me know if you have used QTP in any other environment)

I will explain the use of QTP with below example.

Assume that you are developing an application similar to Gmail.

Once after completing your development you need to test it by doing login with different username and password combination to make sure that your application will allow only the valid users.

For doing this testing, you can just start QTP and do the login activity one time. QTP will record the steps and it will be able to  run the same steps at any time. i-e QTP will  automatically login into your application without doing any manual task other than just starting the QTP script replay.

And, you can feed various username and password data to the QTP script so that it can do the same testing using various data.

QTP provides multilingual support. It supports multi-byte character languages such as Chinese and Japanese also. (But I had faced some difficulties with multi-byte  character languages when using old version of QTP. I believe those problems should have solved now. If you still face any difficulty with using multi-byte characters, you can share your experience thro’ the comments.)

And,  SQL queries can be used within the script in QTP.

Record and Replay feature of this tool can be easily used  by anyone who is having some basic knowledge about computers.

And, QTP can be used by programming experts also as it is supporting the vbscript and the COM.

Because of this wide-range of capability, QTP is widely used by many companies to automate their software testing activities.
So, Job Opportunity for the people with QTP knowledge is more comparing to the other tools.

You can refer the below indeed.com trends for QTP.

 

You can see that the demand for QTP is growing continously.

And, salary is also high comparing to the “Tester” salary.

You can see steady increase during last few months. Normally the corporates will allocate budget for automating the testing activities only when they are in financially good stand. During recession the automation budget will be cut.Since the recession is slowly going away, the demand for QTP resources is getting increased now.

In USD as of Nov 21, 2010

qtp

$84,000 High Confidence (more than 250 sources) Average qtp salaries for job postings nationwide are 16% higher than average tester salaries for job postings.

tester

$72,000 High Confidence (more than 250 sources)

There may be some good open source tools available.

But, QTP is getting used in many Corporates and Banks as HP is doing good marketing and providing enough support. And, HP is working on to improve it continuously.

QTP will be integrated seamlessly with Quality Center which is a Test management Tool provided by HP itself. (It was previously known as “Test Director”) . And it will provide some support for running Win runner scripts also. (If you have WinRunner 7.5 or later installed on your computer, you can include calls to WinRunner tests and functions in your QuickTest test)

QTP can be used for testing various applications such as web applications, java application, vb application, Oracle, SAP, Siebel, ActiveX, peoplesoft and Main frame application. Add-in concept of QTP helps to support wide range of applications.

And, if you are expert in vbscript and COM (Component Object Model), you can manage to fulfill your requirements, even if the built-in features of the Tool is not enough to fulfill your needs.

QTP supports various frameworks such as Data Driven testing and Keyword driven testing. And we can design our own framework also.

And, license of QTP can be managed in various ways such as seat license and concurrent (floating) license.
i-e You can use QTP irrespective of your physical location if you choose floating license. The license server will take care of controlling simultaneous users.

For example, assume that you buy 3 concurrent licenses and 3 of your employees are currently using it. Your 4th employee can  use QTP immediately after one of the 3 employees come out of their QTP instance. It will be managed seamlessly.

I have released an eBook to share my knowledge/understanding about QTP.

The buyers of this ebook were asking me whether I will be providing online training for learning QTP.

So, I announced about the online QTP training.

I am having lot of other tasks such as developing and promoting our products.  So, instead of doing interactive online training, I may release recorded videos in future.

And, if you own a software/web related business and would like to improve the quality of your product you can contact me. Our Team can do software testing so that you can deliver quality product which is very important for your business growth.

Source- What is QTP?