June 16, 2011

Check an alert dialog box and the text from it

In this post I will try to describe step by step how to create a function which checks for a dialog box and will also click on the button within it:

  Firstly we will create a class which we'll be calling on our need:

' creating the generic function
Public Function DialogBox
Set DialogBox = New QTPDialogBox
End Function

' defining the class
Class QTPDialogBox
Public Function CheckDialogBox (obj_DialogWindowId, obj_DialogWindowStyle, obj_StaticWindowId, obj_StaticText)
' defining the Dialog object's properties
Set obj_Dialog = Description.Create  
obj_Dialog ("micclass").value = "Dialog"
obj_Dialog ("nativeclass").value = "#32770"
obj_Dialog ("text").value= "Microsoft Internet Explorer"
obj_Dialog ("window id").value= obj_DialogWindowId
obj_Dialog ("windowstyle").value= obj_DialogWindowStyle

May 12, 2011

Setting a DB connection to run any queries from QTP

How to set a DB connection and to get a value from an "adodb" Data Base
Public Function DBSelect
set conn = createobject("adodb.connection")
conn.open "DSN=DSN_SERVERhere; UserID=userID; Password=password;"
set rs = createobject("adodb.recordset")
'get the date value from DB for an Event
rs.open "SELECT searchColumnHere FROM tableName WHERE columnName='value'", conn
eventsInDB = rs("searchColumnHere")
'eventsInDB = FormatNumber(eventsInDB, 2) - use this if you need to format the output nr
DBSelect = eventsInDB 'here we are defining the output value
End Function

April 4, 2011

Create a function which will return a random number

How to set a "randomValue" to a variable and How to run an UPDATE within a Data Base using this variable
'set a random number - this function will be called to do updates
Function RandomNr
upperbound = 1000-1
lowerbound = i
For i=1 to upperbound
RndNr = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
RandomNr = RndNr
End Function

March 8, 2011

Descriptive Programming

In this post we'll discuss about:

Introduction to Descriptive Programming.
How to write Descriptive Programming?
When and Where to use Descriptive programming?
Some points to note with 
Descriptive Programming.

Introduction to Descriptive Programming:Descriptive programming is used when we want to perform an operation on an object that is not present in the object repository. There can be various valid reason to do so. We will discuss them later in this article.

February 22, 2011

Difference between QTP8.2 and QTP9.0/QTP9.2

Over and above features provided with QTP 9.0 , QTP 9.2 provides following features:
Mercury Screen Recorder :
 Capture your entire run session in a movie clip or capture only the segments with errors, and then view your movie from the Test Results window.

Dynamic Management of Object Repositories:
 QuickTest now has a new RepositoriesCollection reserved object that you can use to programmatically manage the set of object repositories that are associated with an action during a run session.

Over and above features provided with QTP 8.2 , QTP 9.0 provides following features:
Object Repository Manager:
 You can use the Object Repository Manager to manage all of the shared object repositories in your organization from one, central location. This includes adding and defining objects, modifying objects and their descriptions, parameterizing test object property values, maintaining and organizing repositories, and importing and exporting repositories in XML format.

January 19, 2011

The complete list of new features that are available in QTP 11

XPath and CSS based object identification

Identify objects not only using normal object identification but with XPath and CSS identifier properties. A much awaited and a killer feature.

Good Looking and Enhanced Results Viewer

The new improved results viewer provides an executive summary page with summary data, pie charts and statistics for both the current and previous runs and a quick link to the previous run results.

December 24, 2010

QTP 11 available for download.

HP has packaged QTP 11, all its add-ins and HP Service Test under the heading of HP Functional Testing 11. You can download the entire package here (iso file, 3.61 GB). QTP 11 is  available as a 30 days trial unlike its predecessors which were only available for 14 days. (New users need to register on HP’s site. No contract/maintenance required to download trial )
Unfortunately, this means, QTP 10.0 will no longer be available from HP’s download center.
Check the complete list of new features in QTP 11.

December 6, 2010

QTP's Global Settings and Options

To set global testing options Choose Tools > Options or click the Options toolbar button.

November 28, 2010

Pre-requisites for QTP Automation Process

The following are pre-requisites or dependencies for QTP automation process:
  • Knowledge and hands-on experience with the use of QTP;
  • Quality Centre (QC) and QTP installed and configured;
  • QC and QTP are integrated;
  • QTP Add-Ins are installed (if required);
  • QC user groups are defined and granted access to Quality Centre projects;
  • The application or product is in a stable state;
  • Creation of new automated scripts requires existing manual test cases to have been executed successfully. This task is performed by the application tester or business representative and is performed prior to handover to QTP automation.