QTP10.com is a new and completely free website that offers help in all the versions of HP QTP (including latest version 10). More importantly, it offers free code for users of HP QuickTest Professioal. This site helps you in learning the basics of QTP and descriptive/advanced programming in (QTP) on various environments like - .Net, Infragistics, Web, Windows, etc.

Note -
This blog is NOT affiliated with HP / Hewlett-Packard in any way. The data/questions come from various sources and we have our own testing questions. I am just another Software Tester like you.

Product Enhancements in QTP 11

QTP 11 now includes the following enhancements:

  • New Object Spy Functionality
  • Compare, Merge, and Export Object Repositories with Checkpoints and Output Values
  • Add Images to Your Run Results
  • New Dual Monitor Support
  • New Web Test Object Operations
  • New WpfTable Test Object
  • Hide the Keyword View
  • Enable Running QTP Tests on Minimized RDP Session Windows
  • See Version Control Status of Tests, Components, and Function Libraries at a Glance
  • Business Process Testing Enhancements
  • Web Add-in Extensibility Enhancements
  • Get Critical Updates Using the New HP Update Tool
  • Extended Trial Period for QuickTest Seat License
  • Updated QuickTest Asset Upgrade Tool for HP ALM and Quality Center

We will discuss the enhancements in Detail in upcoming articles. Ig you want to compare these with QTP 10, then check out - http://www.qtp10.com/2009/04/new-features-in-qtp-10.html

New Features in QTP 11

Following are some Useful new Features (atleast for me) in QuickTest Professional 11:

  • GUI and UI-Less Application Functionality in One Test
  • The new QuickTest-Service Test integration enables you to test across the GUI and non-GUI layers of your application.
  • Collaborate with Developers to Pinpoint Defects Using Log Tracking
  • Automatically Parameterize Steps
  • New Silverlight Add-in
  • Extend WPF and Silverlight Support
  • Use Extensibility Accelerator for Web Add-in Extensibility Development
  • Smart Regular Expressions – Easy to Insert
  • Load Function Libraries at Run Time - LoadFunctionLibrary statement
  • Avoid Downtime Due to License Server Failures - redundant license server feature

We will discuss each feature in detail in Upcoming posts/articles

QTP Tip - Avoid Redimensioning Arrays

Source – http://technet.microsoft.com/en-us/library/bb727078.aspx

Try to avoid Redim arrays. As far as performance is concerned, if you have a machine that is constrained by physical memory size, it's much better to set the initial dimension of the array to its worst-case scenario—or to set the dimension to its optimal case and Redim as necessary. This does not mean that you should just go out and allocate a couple of megabytes of memory if you know you aren't going to need it.

The code below shows you gratuitous use of Dim and Redim.

  1. Dim MyArray ()
  2. Redim MyArray (2)
  3. MyArray (0) = "hello"
  4. MyArray (1) = "good-bye"
  5. MyArray (2) = "farewell"
  6. ...
  7. ‘Some other code where you end up needing more space happens, then ...
  8. Redim Preserve MyArray (5)
  9. MyArray (3) = "more stuff"
  10. MyArray (4) = "even more stuff"
  11. MyArray (5) = "yet more stuff"

It is far better to simply Dim the array to the correct size initially (in this case, that's 5), than Redim the array to make it larger. You may waste a little memory (if you don't end up using all of the elements), but the gain will be speed.

QTP Tip - Explicitly destroy all objects and close all connections

Destroying objects and closing connections ensures resources are returned to the system. Objects and connections should be closed and destroyed in the opposite order in which they were created. Wait to create objects and open connections until immediately before they’re needed. Likewise, destroy objects and close connections immediately after you’re through with them.

    1. Example:
    2. Set objFso = Server.CreateObject(“Scripting.FileSystemObject”)
    3. set f = objFSO.OpenTextFile…
    4. f.Close
    5. set f = Nothing
    6. set objRS = Nothing
    7. set objConn = Nothing
    8. set objFso = Nothing

Some Important point you should know if you are upgrading to QTP 10 or QC 10

Below are some important points you should know if you are upgrading to QTP or QC 10:


1. Are your scripts built in QTP 9.2? No need to worry. QTP10 is capable of running QTP 9.2 scripts (through QC or locally) even if they are not upgraded.

Scripts are automatically upgraded when opened once in QTP10.


2. Integration with 9.2 versions: QTP10 works well with Quality center 9.2 but Quality Center 10 is not compatible with QTP 9.2.


3. Add-ins Installation: The all-in-one install offers all add-ins integrated with core application, Just need to include this single installer on SDS

QTP Environment Variables Simplified

The variables that are commonly used across the environment in many tests by different resources are know as Environment Variables.

There are Two types of Environment variables

1. Built-in-variables

2. User Defined Variables

Advanced QTP - DP and Child Objects - Simple Code To Validate All Links of a webpage

‘SCENARIO NAME :Check all links
‘DESCRIPTION :This code Check all links in any web page
‘PRECONDITIONS :This Assume that when click on Link the new page will open on current window but not in new window
‘AUTHOR :Mohan kumar

Set oDesc = Description.Create()
‘ Retrieve HTML tag
oDesc(”html tag”).Value = “A”
Set rc = Browser(”title:=.*”).Page(”title:=.*”).ChildObjects(oDesc)
num = rc.Count() ’get the number of link in a page
For i=0 to num-1
Set rc = Browser(”title:=.*”).Page(”title:=.*”).ChildObjects(oDesc)
ref = rc(i).GetROProperty(”href”) ’get the “href”propety of the i th link
Browser(”title:=.*”).Page(”title:=.*”).link(”text:=.*”,”index:=”&i).click ’click on i th link
title1=Browser(”title:=.*”).getRoproperty(”title”) ’get the tile of the target page
MsgBox title1
Browser(”title:=.*”).navigate(ref)’Navigates to the url taken from “href” property
title2=Browser(”title:=.*”).getRoproperty(”title”)’get the tile of the tNavigated page
MsgBox title2
If title1=title2 Then’condition to check for the targetted page and Navigated page
Reporter.ReportEvent 0, “Navigated To Correct Page”,”"&title1′Reports if correct
Reporter.ReportEvent 1,”"&title1,”"&title2
End If
Browser(”title:=.*”).back’Navigates back to main page


Source-  - http://quicktestprofessional.wordpress.com/about/

Count the number of links & Objects in a web page by ChildObjects Method

To count the number of links in a web page, We can use ChildObjects to get the link collection, then retrieve the properties for example number of links or any other objects on page.


Dim oDesc, oAllLinks, iNumberOfLinks
set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
Set oAllLinks = Browser("creationtime:=0").
iNumberOfLinks = aAllLinks.Count
msgbox iNumberOfLinks

Use Local or Shared Object Repositories in QTP? How to Decide?

Deciding Whether to Use Local or Shared Object Repositories in QTP

To choose where to save objects, you need to understand the differences between local and shared object repositories.

QTP Interview Questions and Answers – Part 5

[Source of answers: HP QTP User Guide]
41. How can we run standard DOS commands in QTP tests?
You can run standard DOS commands in your QTP test or function using the VBScript Windows Scripting Host Shell object (WSCript.shell).
For example, you can open a DOS command window, change the path to C:\, and run the DIR command using the following statements:
Dim oShell
Set oShell = CreateObject ("WSCript.shell")
oShell.run "cmd /K CD C:\ & Dir"
Set oShell = Nothing
For more information, refer to the Microsoft VBScript Language Reference (choose Help > QTP Professional Help > VBScript Reference > VBScript).

QTP Interview Questions and Answers – Part 4

How can we define a time interval for QTP to perform a checkpoint successfully?
You can specify the time interval during which QTP attempts to perform the checkpoint successfully by modifying the selections in the bottom part of the Text/Text Area Checkpoint Properties dialog box. You can also specify when to perform the checkpoint.

• Checkpoint timeout. Specifies the time interval (in seconds) during which QTP attempts to perform the checkpoint successfully. QTP continues to perform the checkpoint until it passes or until the timeout occurs. If the checkpoint does not pass before the timeout occurs, the checkpoint fails.

QTP Interview Questions & Answers - Part - 3

How can we do the Analysis of Results in QTP?
The Test Results window contains a graphic and text summary of the results of a run as well as details of each step in the run.

To view the results of a run:
1. If the Test Results window is not already open, click the Results button or choose Automation (menu) > Results.
Tip: You can open the Test Results window as a standalone application from the Start menu. To open the Test Results window, choose Start > Programs > QTP Professional > Test Results Viewer.

1. If there are test results for the current test, they are displayed in the Test Results window.
2. If there are several test results for the current test, or if there are no test results for the current test, the Open Test Results dialog box opens. You can select the test results for any test, or you can search for the test results (results.xml) file anywhere in the file system. Click Open to display the selected results in the Test Results window.
Note: Results files for QTP Professional are saved with a .qtp file extension.
The following example shows the results of a test with three iterations:

(Click on the above image to see the large view)

Problems in maintaining automated QTP test scripts

New versions of software imply a need for new tests for the new functionality, and often changes to existing tests here existing functionality has changed. Furthermore, as the system changes some tests will become redundant, either because the functionality they test has been removed or because new tests have superseded their purpose. All of this contributes to the maintenance costs.

QTP Interview Questions and Answers - Part 2

Which scripting language used by QTP?
Most of the newbie are confuse about this. In many place you will find that QTP uses VBscript, java script and other scripting language.

Actually QTP is using only one language VB script. But it also provide access to its functions and properties thorough it object. That means you can use any other scripting language to access the QTP, but then you will not get the any benefit of its recording technique and other facilities provided by tool.

QTP Interview Questions and Answers - Part 1

What are the Features & Benefits of Quick Test Pro(QTP)..?
1. Key word driven testing
2. Suitable for both client server and web based application
3. Vb script as the script language
4. Better error handling mechanism
5. Excellent data driven testing features


Challenging QTP Questions | Judge yourself in QTP

Part 1

1) How a variable can be made to be accessed by all the Actions of a Test?


a) By using GlobalDataSheet

b) By using Environment variable

c) By Public Function


2) Which Environment variable is used to read product License from a File?


3) The General Error message that appears on loading a file using Environment.LoadFile method is “The format of File is incorrect”. What type of Files can be loaded?