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

Set a DataBase connection and 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
rs.close
DBSelect = eventsInDB 'here we are defining the output value
End Function

April 4, 2011

Create a function which returns 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
Randomize
RndNr = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
Next
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

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.

January 28, 2011

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.

January 19, 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.