Basic QTP Tutorial For Beginners


Dear friend,

On this page you will find all stuff to get started with QTP. In this tutorial we are going to learn below concepts in QTP. If you know the basic concepts in QTP, you can jump to advanced tutorial at Advanced QTP Tutorial


Here is the list of topics that I am going to cover in basic QTP tutorial for beginners.

  1. What is QTP - Brief Introduction. 
  2. QTP - GUI. 
  3. QTP - Record and Playback. 
  4. Actions and Tests in QTP. 
  5. Test Settings in QTP. 
  6. Debugging in QTP. 
  7. Object Spy in QTP. 
  8. Object Identification Mechanism QTP. 
  9. Object Repository in QTP - Local and Shared. 
  10. Description Programming in QTP - Static and Dynamic. 
  11. QC - QTP - Connection. 
  12. Checkpoints and output values in QTP. 
  13. Object Repository Manager in QTP. 
  14. Recovery Scenario Manager in QTP. 
Ok So let us start with the basic QTP tutorial.

1. What is QTP - Brief Introduction.

QTP stands for Quick Test Professional. QTP is an automation testing tool. As of 2013, QTP is the most popular automation tool in the market. In 2011, HP released QTP as a product under UFT - Unified functional Test Software.

Important points to note about QTP are -

  1. Developed by – HP 
  2. Latest Release as of 2011 – 11.0 
  3. Operating System – Windows 
  4. License – Proprietary 
  5. Language Used – Vbscript 
  6. Applications supported - Web, Java , .Net, WPF, SAP, Oracle, Siebel, PeopleSoft, Delphi, Power Builder, Stingray, Terminal Emulator, Flex, Web Services, Windows Mobile, VisualAge Smalltalk, Silverlight and mainframe terminal emulators. 

You can download the latest version of the QTP from hp site at HP Unified Functional Testing 11.50 CC English SW E-Media Evaluation

After downloading the QTP, you can install it by following the on screen instructions.

2. QTP - GUI and different toolbars in QTP.
Ok I am assuming that you have installed the QTP from above link and are able to open the QTP.
When you open QTP you will find below screen for the first time.

It will ask you which add-ins you want to load. By default there are 3 add ins in QTP
Web
Activex
Visual basic.

If you need to test application based on any other technology, you have to install the add-in for that technology separately.

For example - if you want to automate .Net application, you must install .Net add-in as well. Then you will see that option in Add-ins page at the start up. Now you can click on OK. You will now come to the main GUI of QTP.

In QTP GUI, You will find lot of options and tools. We will have a look at each option one by one.

Some of the important options are -

  1. Object spy - Used to learn the properties and values of the objects 
  2. Object Repository - Used to store the test objects. 
  3. Record Button - Used to record the application 
  4. Play - Used to play back the recorded script 
  5. Results - Used to view the results of the script execution. 
  6. Debug Viewer - Used to debug the scripts and watch runtime variables. 
  7. Active Screen - Used to view the snapshot of actual application 
  8. Datatable - Used to store test data 
  9. Expert View - Used to see the code 
  10. Keyword View - Used to see the code in more easier manner. 


I will soon add details of all menus and toolbars here.

3. QTP - Record and Playback

QTP provides very nice feature where in we can record the test steps and QTP will auto generate the code for your script. While recording QTP also stores the objects in Object Repository.

I am going to show you the code generated when I recorded on flight application that comes with QTP installation.

Now let me explain how QTP is generating this code.

Dialog("Login").WinEdit("Agent Name:").Set "sagar"
Dialog("Login").WinEdit("Password:").Setsecure "********"

In first statement ->

In above statements Dialog is the class. Login is the object of class Dialog.
Again Winedit is the name of class. Agent Name: is the object of Winedit type. Set is the method of Winedit class to enter some data into editbox. In above example we have entered sagar into Agent Name editbox.

In second statement ->
Again we have dialog and winedit classes. but here we are using the setsecure method to enter encoded value into editbox.

Once you are done with recording you can playback recorded script automatically.


4. QTP - Actions and Tests

Below video shows how we can create tests and actions in QTP.
Test in QTP is comprised of actions.
One test contains one or more number of actions that perform various operations in Application.

For each action, QTP creates one sheet in datatable and one local object repository. That means Action 1 can only use objects that are available in repository associated with action1.

You can think of action as a typical operation in application. For example, To insert the order, you can create Insert_Order Action and So on.

When you save a test in QTP, lot of files and folders are created on disk. To know these files, you can visit -

http://qtp-interview-questions.blogspot.in/2013/03/folder-structure-and-file-extentions-in.html


5. Test Settings in QTP

Below video shows different test settings that are available in QTP Test.
You have below important Settings.


Object Synchronization Timeout - 20 seconds.
Browser Navigation Timeout - 20 seconds.
Environment Variables - We can create new variables.
Recovery Scenario Setting to Activate particular recovery scenario.
Resources setting to associate function libraries in QTP.
Setting to control whether we should continue or stop execution in case of Error.
Datatable iteration setting.


6. Debugging in QTP Script or Programm

Below video shows how we can debug the scripts in QTP. We can use breakpoints to make the control pause at particular point of code and then we can move forward line by line or block by block. We can also view run time variables using debug viewer tool in QTP.




7. Object Spy in QTP

Below video shows what is object spy and how we can use it in QTP programming. Object Spy is the tool provided by QTP to view the properties and values of the objects in Application under test. We can also use object spy to view the methods supported by any object in QTP.



8. Object Identification Mechanism in QTP.



QTP tries to identify the object based upon madatory properties.
If QTP can not identify the object using mandatory properties then it uses Assistive Properties of the object.
If QTP is still not able to identify the object It uses ordinal identifier ( like index, location) to identify the object.
If still QTP is not able to identify the object uniquely, it uses Smart Identification mechanism to identify the object.



9. Object Repository Types in QTP - Local and Shared


Below video shows the types of object repositories in QTP. There are 2 types of the OR in QTP





Local Object Repository
Shared Object Repository



How to Edit Shared Object Repository(OR) in QTP
How to create a Shared Object Repository in QTP



10. Description Programming in QTP - Static and Dynamic.





Below video shows how we can use descriptive programming in QTP and types of Descriptive programming. We can bypass the object repository.

There are 2 types in which we can use descriptive programming.



Static Descriptive Programming
Dynamic Descriptive Programming -


To know more about dynamic descriptive programming, You can visit http://qtp-interview-questions.blogspot.in/2013/03/description-object-in-qtp.html


11. QC-QTP Connection

We can save the QTP tests in QC and then run the tests directly from QC. You must have QTP add-in for QC installed on your machine. Also You must have QC add-in for QTP installed on your machine for this to work.



12. Checkpoints and Output Values in QTP.


Checkpoints are nothing but verification points in your test cases. For example you need to check if typical editbox has a value say :"ABC". So your standard checkpoint will pass if editbox has a value ABC else it will fail the test.


Output values are used to store the intermediate output from application,. For example, if you want to hold the order number in a variable for further processing, you can use output values.



13. Object Repository Manager in QTP.

Below video shows how we can use Object Repository Manager in QTP.

 Object repository manager in QTP is used to -



  1. Edit shared object repository
  2. Merge 2 shared object repositories
  3. Compare 2 shared Object Repositories
what is the use of object repository manager in QTP

14. Recovery Scenario Manager in QTP.

Below video shows how we can use Recovery Scenario Manager in QTP.

Recovery scenarios are used to handle the unexpected events in application. For example your application might crash or Some pop ups might come when you are running your automation scripts.


To handle such events, you can create recovery scenario and then associate the scenario for the QTP test.

In case such events happen, QTP will invoke the code which will perform recovery operation and continue the test from there onwards. So this helps in unattended automation execution.


Use of Recovery Scenario Manager in QTP

***********End of QTP Tutorial For Beginners**********

If you have grasped the basic concepts in QTP, you can now move to advanced QTP tutorial at advanced qtp tutorial
To have a look at basic QTP interview Questions You can click here .
To have a look at more advanced QTP interview Questions click here

You may also like -
QTP Questions and Answers for Experienced guys
Advanced QTP Questions and answers
Advanced QTP Tutorial


Dear friend - What do you think about this topic? Please express your thoughts via comment box.

1 comment:

  1. This is the best ever tutorial on QTP.
    Thanks for this one.

    ReplyDelete

Please Leave your reply. We value your feedback and inputs

Best QTP Books

Everything About QTP

Hello Friends,
You can find QTP study material, Multiple choice questions (mcq), QTP question bank, QTP question papers, QTP notes, QTP questionnaire, scenario based QTP interview questions, QTP tutorial and QTP training on this site.

If you are a fresher or experienced QTP professional with (1/2/3/4) years of experience, this blog is just for you.