Login   /   Register
Code Design

Class Delegation

May 29th, 2010 by Yaron Assa
     5 votes, average: 3.6 out of 55 votes, average: 3.6 out of 55 votes, average: 3.6 out of 55 votes, average: 3.6 out of 55 votes, average: 3.6 out of 5
Loading ... Loading ...

Steve Windom has graciously shared the following article on Class Delegation.

We’ve previously touched upon this subject under Class Composition and Function Pointers articles, but Steve’s article provides a coherent and clear view.

Event Manager

March 12th, 2010 by Yaron Assa
     6 votes, average: 4.17 out of 56 votes, average: 4.17 out of 56 votes, average: 4.17 out of 56 votes, average: 4.17 out of 56 votes, average: 4.17 out of 5
Loading ... Loading ...

Senior Automation Engineer Akien MacIain has done it once again. Much like his breakthough VBScript++ article, this detailed and high-quality article give a great insight into complex code structures in VBScript and QTP, while keeping things as simple and as approachable as possible.
This time, Akien focuses on simulating event driven code in VBScript - and important and interesting concept.

Thanks again, Akien, for putting so much effort into helping the QTP and VBScript community!

VBScript++

January 11th, 2010 by Yaron Assa
     5 votes, average: 4.4 out of 55 votes, average: 4.4 out of 55 votes, average: 4.4 out of 55 votes, average: 4.4 out of 55 votes, average: 4.4 out of 5
Loading ... Loading ...

Akien MacIain, Senior Automation Engineer, has invested a great deal of his time in preparing a wonderful tutorial to his advanced Object-Oriented implementation in VBScript: VBScript++
While VBScript++ interfaces are quite understandable and intuative (as these things go, at least), it’s meant to the more savy programmers than the run-of-the-mill automation engineer.
Akien’s tutorial is an excellent doorway to a more complex world, and is a very recommended read to anyone who wish to broaden his horizens, or anyone interested in a very well thought of framework.

Thanks, Akien, for putting so much effort into helping the QTP and VBScript community!

Implementing a GUI layer with classes (Russian Translation)

May 11th, 2009 by Yaron Assa
     2 votes, average: 4 out of 52 votes, average: 4 out of 52 votes, average: 4 out of 52 votes, average: 4 out of 52 votes, average: 4 out of 5
Loading ... Loading ...

Sergey Talalaev has put his time and effort into translating Meir Bar-Tal’s article on Implementing a GUI layer with classes into Russian. We full-heartily thank Sergey on his continued help and support to the QTP community!

Implementing a Generic Iterator with Function Pointers

January 19th, 2009 by Meir Bar-Tal
     6 votes, average: 4.33 out of 56 votes, average: 4.33 out of 56 votes, average: 4.33 out of 56 votes, average: 4.33 out of 56 votes, average: 4.33 out of 5
Loading ... Loading ...

This article describes a powerful technique that exploits my previously outlined innovation - Function Pointers in VB Script - to build a generic mechanism having the capacity of executing components repeatedly: the generic iterator.

Implementing a GUI Layer with Classes

December 20th, 2008 by Meir Bar-Tal
     11 votes, average: 4.09 out of 511 votes, average: 4.09 out of 511 votes, average: 4.09 out of 511 votes, average: 4.09 out of 511 votes, average: 4.09 out of 5
Loading ... Loading ...

This article describes a powerful technique that exploits Object Oriented Design Patterns, QTP descriptive programming (DP) and the Dictionary object to pack together GUI objects with their corresponding business oriented functions. The article includes a valuable bonus: a highly effective tip that enables to exit a test smoothly, preventing QTP from getting stuck when it fails to identify GUI objects during runtime.

Function Pointers in VB Script (revised)

December 9th, 2008 by Meir Bar-Tal
     2 votes, average: 4.5 out of 52 votes, average: 4.5 out of 52 votes, average: 4.5 out of 52 votes, average: 4.5 out of 52 votes, average: 4.5 out of 5
Loading ... Loading ...

Function pointers are used in C and C++ to enable callbacks and as a result, more generic and parsimonious coding. This article shows how to implement function pointers in VB Script using the Scripting.Dictionary object and the Command Wrapper design pattern. It is also shown how to implement “constructor” functions, callbacks and event handlers.

Class Inheritance in VBScript – Now at your Doorstep!

October 4th, 2008 by Yaron Assa
     7 votes, average: 4.14 out of 57 votes, average: 4.14 out of 57 votes, average: 4.14 out of 57 votes, average: 4.14 out of 57 votes, average: 4.14 out of 5
Loading ... Loading ...

VBScript’s lack of class inheritance can be quite problematic for those of us who are using Classes regularly throughout our scripts. The attached file provides a parser which enables you to effectively use class inheritance in VBScript by placeing ‘ ParentClassName comments within your classes. The mechanism will:

1. Enable inheritance from multiple parents (just use multiple lines with Inherit comments)
2. Copies Properties, Variables, Functions and methods from the parent class to the derived class.
3. In case the derived class already has a code segment with the same name, the copied code-segment is changed to MyBase_. Inner segment placements are updated accordingly.
4. Enables inheritance through multiple hierarchies (e.g. GrandParent->Parent->Child inheritance). Circular inheritance protection. The order of appearance in the files is irrelevant, the parser will make sure the parent classes are parsed before their derived classes.
5. The parser has a major downside – as the technique uses ExecuteGlobal to load the processed classes into QTP, you cannot debug the code in mid-run.

An Improved Dictionary Object

June 19th, 2008 by Yaron Assa
     6 votes, average: 4.67 out of 56 votes, average: 4.67 out of 56 votes, average: 4.67 out of 56 votes, average: 4.67 out of 56 votes, average: 4.67 out of 5
Loading ... Loading ...

This article will offer an improved version of the native Scripting.Dictionary object, and provide a step-by-step guid for building it.

Class Composition

March 29th, 2008 by Yaron Assa
     7 votes, average: 4.14 out of 57 votes, average: 4.14 out of 57 votes, average: 4.14 out of 57 votes, average: 4.14 out of 57 votes, average: 4.14 out of 5
Loading ... Loading ...

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 you’ll see the huge benefits we can gain by selectively using this technique, you’ll at least try it.

Introduction to classes

March 29th, 2008 by Yaron Assa
     1 votes, average: 4 out of 51 votes, average: 4 out of 51 votes, average: 4 out of 51 votes, average: 4 out of 51 votes, average: 4 out of 5
Loading ... Loading ...

This article will very briefly cover the subject of VBScript classes. My purpose is not to do a detailed sweep, but only a quick reminder in order to move forward to more advanced topics and techniques in articles to come. You can find detailed information and demos on this subject in the book Scripting Quicktest […]

Factory Pattern

March 29th, 2008 by Yaron Assa
     1 votes, average: 5 out of 51 votes, average: 5 out of 51 votes, average: 5 out of 51 votes, average: 5 out of 51 votes, average: 5 out of 5
Loading ... Loading ...

This article refers to design patterns, pointers and objects (discussed in the background section of this article), and classes. Make sure you’re familiar with these issues before reading on. It would also be prudent to brush up on the Singleton Pattern.
We continue our tour of Design Patterns with another basic pattern – the Factory (or […]

Singleton Pattern

March 29th, 2008 by Yaron Assa
     2 votes, average: 5 out of 52 votes, average: 5 out of 52 votes, average: 5 out of 52 votes, average: 5 out of 52 votes, average: 5 out of 5
Loading ... Loading ...

This article refers to design patterns, pointers and objects (discussed in the background section of this article), and classes. Make sure you’re familiar with these issues before reading on.
We begin our exploration of the word of Design Patterns with one of the simplest patterns – the Singleton. The Gang of Four eloquently summarize the intent […]

Introduction to design patterns

March 29th, 2008 by Yaron Assa
     1 votes, average: 3 out of 51 votes, average: 3 out of 51 votes, average: 3 out of 51 votes, average: 3 out of 51 votes, average: 3 out of 5
Loading ... Loading ...

This section relays heavily on your familiarity with basic code design concepts and approach. Make sure you read the introduction to code design before proceeding.
Parts of the following introduction are rewrites (more accurately downgrades) of the preface to the groundbreaking book Design Patterns: Elements of Reusable Object-Oriented Software, written by the “Gang of four”. If […]

Checkpoints and points-of-view

March 29th, 2008 by Yaron Assa
     4 votes, average: 3.25 out of 54 votes, average: 3.25 out of 54 votes, average: 3.25 out of 54 votes, average: 3.25 out of 54 votes, average: 3.25 out of 5
Loading ... Loading ...

Many of QTP’s downsides are due to the inherent tension between trying to be beginner-friendly, to having enough depth and complexity for writing real automation scripts. It’s more than just having too many menus and options – in some cases; QTP induces shallow thinking and bad habits. I apologize for being dramatic, but in my […]

Abstraction Leaks

March 29th, 2008 by Yaron Assa
     2 votes, average: 5 out of 52 votes, average: 5 out of 52 votes, average: 5 out of 52 votes, average: 5 out of 52 votes, average: 5 out of 5
Loading ... Loading ...

Abstractions
Abstractions are the cornerstone of any successful program. An abstraction is a blackbox, wrapped around some very complex real-world mechanism. This magical blackbox allows us to use it, without dealing with the actual complexity that goes on inside.
For example, characters are abstractions: There is no character data type in the real world, since characters are […]

Negative Tests

March 29th, 2008 by Yaron Assa
     5 votes, average: 3.2 out of 55 votes, average: 3.2 out of 55 votes, average: 3.2 out of 55 votes, average: 3.2 out of 55 votes, average: 3.2 out of 5
Loading ... Loading ...

Background & Motivation
Negative tests are a crucial part of application testing – they ensure us the application contains “bad” user behavior and illegal inputs in a controlled fashion. Having said that, usually there’s never enough time, resources and personal to automate the “positive” tests; let alone the negative ones. This is not an inevitable situation […]

Object Dictionaries for Generic Functions

March 29th, 2008 by Yaron Assa
     2 votes, average: 4 out of 52 votes, average: 4 out of 52 votes, average: 4 out of 52 votes, average: 4 out of 52 votes, average: 4 out of 5
Loading ... Loading ...

Today we’ll cover a valuable technique that will enable us to greatly simplify and organize our code, by adding meta-data to our QTP objects. The technique is best used when coupled with DP, though with certain adjustments, it works fine with OR based scripts as well.
The content you are accessing is for registered users onlyRegisteration […]

Introduction to Code Design

March 29th, 2008 by Yaron Assa
     3 votes, average: 4.67 out of 53 votes, average: 4.67 out of 53 votes, average: 4.67 out of 53 votes, average: 4.67 out of 53 votes, average: 4.67 out of 5
Loading ... Loading ...

This will be the first of many articles dealing with code design. What is code design? In object oriented languages it sometimes stands for deciding on the object class and structures needed to elegantly complete a task. For us it will just be a set of abstract principles that will allow us to write readable, […]

Function Pointers in VBScript

October 22nd, 2007 by Meir Bar-Tal
     6 votes, average: 4.83 out of 56 votes, average: 4.83 out of 56 votes, average: 4.83 out of 56 votes, average: 4.83 out of 56 votes, average: 4.83 out of 5
Loading ... Loading ...

This 14-page article by Meir Bar-Tal explains in details the benefits and inherent possibilities in wrapping our functions with classes. It further explores the meaning and logical structure of classes, and shows how we can easily implement constructors, event handlers and callback by using class composition and function wrapping.
The different techniques are well illustrated […]