Tag Archive: Class

Sep 28 2013

Google Search Automation

Through the years I have been asked many times by novices to automation and QTP about Google/Gmail automation. This short post provides an example of Google search automation using a class (see below). The class encapsulates opening the Browser (invoking Internet Explorer), navigating to the Google.com page, searching and retrieving the results. The Main Procedure …

Continue reading »

May 29 2010

Class Delegation

Inheritance is a common way of extending and reusing the functionality of a class. Delegation is a more general way to extend a classes behavior. Delegation extends a class by using other classes functions, subroutines and properties rather than inheriting them. Inheritance is inappropriate for many situations in which delegation works well.
For example, inheritance is useful for capturing a “is-a-kind-of” relationships because of their very static nature. However, “is-a-role-played-by” relationships are akward to model with inheritance. With delegation you get instances of classes that can play multiple roles.

Mar 12 2010

Event Manager

In traditional test automation, if an unexpected message box came up, such as a printer error message, the script would either halt, or it would have to contain numerous checks at different places in case such a window came up. Some testing tools allow you to set “traps” that will respond to simple message boxes by specifying the message box and the button to click, but if your tool lacks that, or if it’s more complex to deal with the dialog than simply pressing a dismiss button, then the script will be unable to respond to it, and the test will fail for reasons completely unrelated to the test.

Jan 11 2010


For the entire time I’ve been working with HP QuickTest Pro and VBScript, I have had a yearning for real object support. Specifically, inheritance and polymorphism. I am a big fan of reusing every piece of code I can, and these two attributes contribute more to my productivity than any other concept in software development.
In addition, at one point when we were performing a refactoring of our automation framework

Dec 08 2008

Adding a Call-Chain Mechanism to QTP

Background and motivation A common frustrating experience is having your script pop-up an error dialog in some long-forgotten function, without one having the slightest clue in its regard. What usually follows is a series of trial-and-error breakpoint runs to determine which action the script was actually trying to perform when executing the function call that …

Continue reading »

Oct 15 2008

Class Inheritance in VBScript – Now at your Doorstep!

ChangeLog: 5/10 : I’ve uploaded a new file with the fixed parser. Added support for code blocks with sensitive names (Function PrivateFunciton, Sub SpecialGet etc.) 10/10 : I’ve uploaded a new file with constructor arguments support, and a new regular expression engine (preserves comments and should make things go faster). Notice that the new file …

Continue reading »

Oct 10 2008

Constructor Arguments in VBScript!

Our Class Inheritance Parser has just received a major update. Among the changes is the support for Constructor Arguments. Most programming languages allow you to pass parameters when you create an instance of your class. These are called constructor arguments. VBScript’s constructor (the Class_Initialize sub) can not receive parameters, so usually we must resort to …

Continue reading »

Jun 19 2008

An Improved Dictionary Object

The Scripting.Dictionary object can be an extremely useful tool for storing and retrieving information. We’ve had a whole series of QTips covering it’s basic uses, as well as some advanced articles of using it as a reserved global dictionary, a parameter storage for generic functions (here and here), and more. However, with all its power, …

Continue reading »

Apr 01 2008

Dictionary of Employees

Demonstration script that combines the usage of classes and dictionary object. Script must be run on the local computer. Class Employee Private fname,lname,m_id,m_city,m_country Public Property Get FirstName() FirstName = fname End Property Public Property Let FirstName( value ) fname = value End Property Public Property Get LastName() LastName = lname End Property Public Property Let …

Continue reading »

Mar 29 2008

Class Composition

This article deals with classes and their instances in VBScript. Make sure you’re familiar with the subject by reading the introduction article to classes. In this article we’ll cover the basics for composing classes (i.e. using one class from within another), and some common and less common uses for this technique. I’m sure that once …

Continue reading »

Older posts «

Fetch more items