Owner: AdvancedQTP URL:http://advancedqtp.com Join Date: Tue, 18 Sep 2007 16:01:10 -0500 Rating:0 Site Description: Learn advanced programming in Quicktest Professional (QTP) and VBScript Site statistics:Click here
VBScript Classes 101 2007-09-18 08:20:45 A new article is available in the knowledge-base: Using VBScript classes!
This article very briefly covers 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.
Among the article's topics are the syntax of declaring a class and its members, as well as how to work with a class instance object. It could serve as a quick reminder for those who are familiar with the subject, or a short intro for those who never heard of it.
Either case, it's a prelude for more complex articles to come.
Enjoy! Read more:Classes
Site Update Report 2007-09-15 18:42:25 If you're not reading this via RSS, it means that you're looking at the new reincarnation of AdvancedQTP!
I'm pretty sure the upgrade has went relatively well, with only a few bugs and problems.However, I'm also sure that there are problems that've slipped my attention. So PLEASE, if you notice anything that doesn't seem to work - broken links, missing images, downloads that lead to nothing etc., LET ME KNOW. And the sooner the better.
Thanks.
Meanwhile, enjoy the new site!
Yaron. Read more:Update
Upcoming Site Update 2007-09-11 22:38:34 One of the main reasons I've been short on time lately, is that I've been working on a new update for the site. I've very happy to announce that this weekend, the site will undergo the update, so expect some downtime and problems throughout the weekend.Other than features that are really important to me from an administrator point of view (better word import, decreased server load, better spam filters etc.), that update will include many user centered features: Save a printer friendly version of an article, either as plain text, or download as a PDF.Customize the sidebar for better surfing.View comments from the main page (i.e. as opposed to be forced to go to the article page itself).Faster page-load.Better layout and AJAX components to simplify site browse and navigation.Better search engine.Better download interface for projects and demo files.Any many other features are yet to come.Have fun.Yaron. Read more:Upcoming
, Update
Product Review - Test Design Studio 2007-09-06 22:42:21 I don't usually do this, but every once I a while, there comes a product which not only dramatically improves my work and productivity, but is also extremely cool. Test Design Studio (TDS) is exactly that, and it deserves your full attention. I've been working extensively with TDS for the past week, and I thought I write a quick review and tell you about it.
Introducing TDS
TDS is a complementary tool to QTP and WinRunner, which upgrades your programming experience to that of VisualStudio. Since the programming experience in QTP is extremely bad to begin with, upgrading it may not seem like a big deal; but let me tell you here and now – TDS revolutionizes the field of QTP and WinRunner programming, and you owe it to yourself to try it out. Once you give it a try, I doubt you ever go back.
The TDS suite comes packed with dozens of features, and I'll cover only a handful. So again, I strongly recommend you download the trail version and try it out yourself. I will
ReporterManager version 0.9 is out! 2007-09-02 22:59:48 A new version
of ReporterManager is available - 0.9!
The new version includes several improvments, including two new engines (DB and Win-log), code enhancements and fixes, and an extensive new development and documentation framework, courtesy of Test Design Studio (more on TDS in the project's home).
The version's details, chang-log and download package can be found in the project's home.
For those of you who don't know what ReporterManager is, here's a brief backgroud:
ReporterManager allows you to easily set up any combination of reporters, set complex rules for each and every reporter, and immediately use them in your scripts. After setting the reporters once, using the mechanism boils down to one simple command: oReporterManager.Report.
You can choose from (so far) 7 reporting engines - User timed popup message, Excel, Styled Text, Screen Capture, Windows event log reporter (local or remote), DB reporter and the native QTP reporter.
You can and apply as
Shell32 - A new chapter from Scripting QTP 2007-08-29 22:02:22 A new chapter from Scripting Quicktest Professional is now available : Working with Shell
32.
In this chapter, we explore windows Shell32 interfaces and objects, which allow us to access special folders and functions, and execute basic user network tasks.
As we’ll see, we can easily mimic basic user actions with the Shell32 object, without dealing with QTP’s problematic abilities to operate windows screens and submenues.
Enjoy :)
The .Net Form Spy 2007-08-26 03:21:58 This post extends the .Net Custom Controls article; please make sure you read it to better understand the post.
In the .Net Custom Controls article, I've talked about the different methods for finding useful properties and methods in a custom .Net object. I've mentioned we could guess certain properties (e.g. a tab name would probably hide in the .text or .caption properties), or use the control's documentation to find them out.
However, there's a third option I've neglected to mention. It does have its downsides, but it's still a valuable technique that should be included in your tool box. This option is the .Net Form Spy.
You can access the .Net Form Spy via the Tools top menu in QTP. Once the tool is opened, you operate it like the regular object spy (i.e. point to an object with the hand icon). The tool exposes two levels – the object's events (which can be very useful for other tasks), and the object's properties, which are what we came for.
As you'll soon find o
The first ReporterManager Code-Walkthrough is here! 2007-08-20 21:34:12 A new knowledge-base article is available - a ReporterManager main-class code-walkthrough!
ReporterManager is a site project that allows the user to manage complex QTP logs via different engines (text, excel, etc.). As promissed (though a little late), here's the first in-depth code-walkthrough for the project's main class.
Since the walkthrough demonstrates many code-design aspects, and VBScript class coding techniques, it's recommended both to those who want to understand the project better, and also to anyone who wants to expand his or hers knowledge on VBScript classes, and general programming.
Enjoy :) Read more:Walkthrough
Abstraction Leaks and QTP 2007-08-14 21:36:10 A new article was added to the knowledge-base - AbstractionLeaks
and QTP!
The article explains abstraction in programming, and demonstrates (some of) the different abstraction layers in QTP. It goes on to show what happens when an abstraction can't pull it's weight (Abstraction Leak), and the price we pay when that happens in QTP.
The article is meant to set the theoretical base for designing our own abstractions framework for QTP, that will be revealed in the coming months.
Enjoy :)
WSH - Windows Script Host - A new chapter from Scripting QTP 2007-08-10 05:06:36 A new chapter from Scripting Quicktest Professional is now available : WSH - Windows
Script Host.
In this chapter, we dive into the depths of the windows host mechanism. We’ll learn how to use windows script objects to manage the computer, pop-up messages to the user, and even run scripts on remote meachines.
The chapter is quite advanced, but it can open a world of possibilities you never thought of.
Happy reading! :)
Class Composition 2007-09-24 22:40:38 A new Knowledge-Base article is now available - Class Composition
!
In this article, we continue our exploration of class structures in VBScript, while focusing on the inherent possibilities in hosting one class instance within another. The article covers the basic composition techqniques, and explains thier benifits, from setting up powerful tree structures, to enchancing our main class with capabilities of our utility classes.
This article can be quite complicated and challenging, so I suggest you follow the code examples carefully, and experiment with the technique on your own.
I find class composition extremely powerful, and I use it in every major project I'm working own (e.g. ReporterManager is completely based on class composition). I hope you'll also find it useful.
Yaron.
Using DotNetFactory - A new chapter from Scripting QTP 2007-09-22 23:01:48 A new chapter from Scripting Quicktest Professional is available - Using DotNetFactory!
In this chapter, we examine what I think is the biggest unspoken killer-feature of QTP - DotNetFactory.
DotNetFactory allows you to create instances of .Net classes within your QTP script, and use them to your liking. I've previously discussed some of the uses of DotNetFactory, but in this chapter, Dani takes things much further.
The chapter shows, step by step, the advantages of using DotNetFactory via two main examples. It takes you through detailed code-walkthroughs and shows you just how simple life could be when using the .Net world. As always, the examples are crystal-clear, and the code walkthroughs as extremely detailed, including screen shots and footnotes.
So go right ahead and download the full chapter!
Enjoy :)
VBScript nitpicking (the good kind) - Part 2 2007-10-02 22:55:08 This is part 2 of VBScript nitpicking article.
Possible ByRef catastrophes
The example from part 1 (regarding passing objects as ByVal parameters) might lead us to believe that when passing an object to a function, we shouldn't care less if it's passed ByVal or ByRef, as we're passing the object's reference in any case. Any change to the object within the function's scope will inevitably effect the outside world, so there doesn't seem to be any difference between the two methods. However, there is one special case that makes all the change in the world.
Let's imagine two new functions:
Sub DoIt(ByVal oDictionary) oDictionary.Add "Did It", True Set oDictionary = NothingEnd Sub Sub DoIt2(ByRef oDictionary) oDictionary.Add "Did It 2", True Set oDictionary = NothingEnd Sub Set oDic = CreateObject("Scripting.Dictionary") Call DoIt (oDic)MsgBox oDic.C
VBScript nitpicking (the good kind) - Part 1 2007-10-02 22:35:26 A very refreshing debate at SQAForums has really opened my eyes on the small details involved with Objects, Scopes and Procedure calls. I thought it was a good idea to write a summary of what went on there, and I took the opportunity and added a very detailed background about many basic terms that may be useful to VBScript and programming beginners.
It might seem that the matters I'll cover are nitpicking in the worse sense – useless, meaningless deliberation over situations that will never happen. However, I can assure you that these situations do happen, and when they do, you'll get a script that's inconsistent and impossible to debug. So it is nitpicking, but it's the useful kind :)
Before we begin, I have to thank Terry Horwath for correcting some misperceptions I had about objects and references. His contribution has led me to dig deeper into the VBScript engine and find out some of the inconsistencies I'll talk about today.
Background
First of all
Accessing PDFs - a new chapter from Scripting QTP 2007-10-02 02:43:26 A new chapter from Scripting Quicktest Professional is upon us - Accessing PDFs.
In this chapter Dani manages what I thought was impossible - automating PDF operations and validations in a robust and maintainable way! Dani takes us through the PDF run-time object model and shows how to use the different properties and methods to perform pretty much anything you can imaging.
To make things clearer and more understandable, Dani expands the syntax examples to full blown code snippets that achieve real-world functionality, providing both cut-and-paste value, as well as excellent self-learning reference.
If your application has any connection to PDFs, I STRONGLY advise reading this chapter. Actually, I advise it regardless of your AUT, it's just too good to skip.
So go right ahead and get the chapter!
Enjoy.
Win32 API - a new chapter from Scripting Quicktest Professional 2007-09-30 10:13:47 Presenting a new chapter from Scripting Quicktest Professional - Win32 API.
In this chapter we explore dozens of windows functions and extension which could make our scripts ever so richer and powerful. These functions and extension could be linked to your script via the Extern.Declare method, and be used in various ways in your script from then on (somewhat like DotNetFactory).
As always the chapter is filled with detailed example as to the syntax and demo uses of Extern.Declare.
So go right ahead and get the chapter!
Working with SVG - a new chapter from Scripting QTP 2007-10-13 08:24:56 A new chapter from Scripting Quicktest Professional is available - Working with SVG!
This chapter deals with a very specific niche technology - SVG - Scalable Vector Graphics. It’s an XML markup language for describing two - dimensional vector graphics, both static and animated, and either declarative or scripted. It is an open standard created by the World Wide Web Consortium.
This chapter can be crucial for those of you who deal with this technology and its different implementations. It shows how to process the information, recognize the relevant objects, and perform common tasks, all with extensive source code examples and demonstrations.
So go right ahead and get the new chapter!
The Framework Manager project is here! 2007-10-04 06:43:12 FrameworkManager – for elegant, clean scripting with QTP.
FrameworkManager lets you program better, cleaner tests by handling all the troubles and nitpicking of the application's UI level for you.
Besides providing an extremely simple interface to building and maintaining you scripts, FrameworkManager solves one of the biggest problems with QTP's native OR and DP. These mechanisms don't carry sufficient data from the real-world into the test (e.g. is an input field mandatory, are two fields connected etc.).
Usually we compensate by constructing huge Select-Case or If structures (if the field can only take Emails, do this, if it can take only addresses, do that), but they soon become too clumsy and complicated to maintain. Before you know it, introducing and new field to the application becomes a daunting task of repetitive code-fixes and patches. With FrameworkManager these are all things of the past.
FrameworkManager allows you to carry just the right amount of information fr
Site Update - Q&A Forum 2007-10-19 02:19:03 AdvancedQTP is happy to announce the opening of its very first forum!
As we've mentioned before, lately we've found ourselves unable to answer you in a timely fashion (via the Ask-Me feature). This led us to think about opening a Q&A feature in which all the site's QTP experts can participate - or in other words, a forum.
Dani and Myself (Yaron) will still visit the forum and answer questions to the best of our abilities, but now we won't leave you hanging until we do. The old Ask-Me page will remain for reference only, and as of today, you won't be able to post any new questions there.
The forum is located here (and the top navigation bar link has changed from Ask-Me to Forum
). You'll need to log-in in order to post a new topic or replay - you can use your AdvancedQTP user-name and password to do so.
I hope you'll find this feature helpful!
Don't hesitate to report any problem in the TroubleShooting forum.
Yaron. Read more:Update
Error Handling - a new chapter from Scripting QTP 2007-10-19 02:02:41 A new chapter from Scripting Quicktest Professional - Error Handling
!
In this chapter we cover the world of error handling in QTP and VBScript. We explore the concept of error handling from a code-design point of view, and clarify the governing concepts for doing it properly. Other than the conceptual overview, the chapter demonstrates the specifics of error handling in both QTP and VBScript.
It runs through working with the different recovery scenarios and dealing with the Err object, and how you can combine them both to make your script more robust and complete.
A must episode for anyone who needs to relay on his scripts and their results!
So go right ahead and get the chapter!
Site Updates & User Registration 2007-10-16 22:57:53 Hey all,
As you must have noticed, AdvancedQTP is getting busier by the day, as evident by the user count and daily pageviews growth. While we're delighted with the situation, it does have certain drawbacks, such as the site's slow load-time, our inability to invest our time (=money) in developing quality content or respond to your questions in a timely fashion.
These are some of the reasons we've decided to take the site more seriously, which means (among other things) moving to a decent server, building a professional infrastructure and adding more features and services to the site. However, these things cost money, and quite a lot of it. As it's one of AdvancedQTP's core principles to share our content for free, it's pretty obvious that we won't ask YOU for the money, but rather some sponsor or endorser. In order for us to do so, we need to better map the site's target audience and visitors, which means we need to know a little more about you.
How will this be done? As of Read more:Registration
, Site Updates
Working with MS-Office Documents? Use DsoFile! 2007-10-23 20:06:00 Working with MS-Office Documents
? Use DsoFile!
This article by Dani Vainstein demonstrates how we can use the DsoFile dll to automate and validate certain aspects of MS-Office files. DSOFile is a COM component by Microsoft, which allows you to easily read and write from different Meta-fields in an MS-Ofiice document.
The techniques shown in this article can help you set up a much more effective MS-Office automation framework, without getting yourself knee-deep in the full-blown world of MS-Office COM.
So go right ahead and get the article!
Intellisense and COM 2007-10-22 06:04:51
Background
In a previous article, I've discussed (among other things) the possibility of adding COM objects to the QTP reserved objects pool, thereby enabling some limited sort of intellisense for them (i.e. Syntax auto-complete).
This is all very nice, but what happens when we want to do something similar with our custom classes and objects? It seems that since the process involves specifying the object's COM ProgID, we can only add "proper" objects to the QTP reserved objects pool (e.g. Excel.Application or Scripting.Dictionary objects). For those of us who use custom classes and object on an everyday basis, this becomes a huge limitation on the method.
Well, have no fear, a solution is here. MilindCD from SQAForums has published a solution which allows us to write our own classes, create a COM wrapper around them, and then add them to the QTP reserved objects pool. It can be quite cool as it allows us to create custom extensions of VBScript's "regular" objects,
Function Pointers - A new article by Meir Bar-Tal 2007-10-21 23:05:31 A new article is available in the knowledge-base - Function Pointers
!
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 using extensive code-snippets, and the article includes several appendixes to make sure you won't miss a thing. This article will probably add a programmer's touch to your growing set of QTP techniques and points of view.
So go right ahead and get the article!
Thanks to Meir Bar-Tal for sharing his advanced knowledge with us!
Please notice that this article is distributed under a different license than the rest of the articles on the site (GNU). See the article's introduction for more details.
The StringUtil project is here! 2007-10-20 10:05:58 The StringUtil project is here!
A teaching project by Dani Vainstein, which gives you the power of string manipulation of Dot.Net framework. Harness the amazing power of .Net to perform extremely complex string operations in seconds!
StringUtil brings an end to compromising for messy code and lengthy functions - from now on your code could look as elegant and simple as you’d like, while allowing you to do even more than before.
The project is designed to be a teaching project - it will include full documentation, examples and source code, all for your comfort and knowledge. StringUtil can become your stepping stone to utilizing .Net classes and objects in a wide range of problems and situations.
After a few minutes with this project, you’ll be able to use commands such as:
oStrUtil.SubString( 2, 3 ).ToLower().EndsWith(">").Concat(".").CompareTo(">.")
And as amazing as it may sound, they would work, and perfectly so!
So go right ahead and
Sorting Arrays using Sorting algorithms Part I 2007-10-27 19:48:44 A new article by Dani Vainstein is available - Sorting
Arrays (part 1)!
You can automate projects for so long before you come across a sorting problem. Maybe it's a list of potential values that needs to be read into the script, maybe it's a list of users that has to be taken from the DB, or maybe it's your plain old output compare validation - no matter what the specifics are, you come to a point where you're gonna need to use a good sorting algorithm to pull it off.
My experience tends to be frustrating around this point - it seems that even though there are countless sort and search resources on the web, they are either too theoretical and academic (and hence useless for my immediate needs), or practical - but in a different syntax (e.g. C++, .Java, etc.). Either way, they are useless to the QTP programmer who needs a solution HERE and NOW.
Well, No more! From now on you can get an immediate (though deep) solutions to all your sort problems.
In this article, Dani Vainstein begin
A fresh look on RegisterUserFunc 2007-10-27 11:22:48
Background
Today we're going to deal with an often overlooked feature of QTP – RegisterUserFunc. Though RegisterUserFunc can offer some real-world benefits, newcomers to the QTP world are unfamiliar with it, and QTP experts look down on it (when comparing it to their custom frameworks). I intend to shed some new light on this feature and its inherent possibilities, and make it more accessible to and appealing to newcomers and experts alike.
RegisterUserFunc allows you to add a new method or override an existing method for a certain QTP class. For example, you can add a new method called "Move20" to all VBWindows in your scripts, which will move them 20 pixels to the right; or override the VBWindow "Close" method by adding your own code for dealing with "save changes" pop-ups that may appear when you try to close them.
Either way, RegisterUserFunc shifts the way of extending your scripts power and functionality from writing functions which receive o Read more:fresh
Intoduction to Design Patterns 2007-10-31 00:01:45 A new article is available in the Knowledge-Base: An Introduction to Patterns
.htm">Design Patterns
!
This article explains the core concepts of Design Patterns - a once revolutionary (and now mainstream) code-design methodology. Like most code-design terms and concepts, Design Patterns are "meant for" object oriented languages, so the article "downgrades" the concept in order to fit it into a VBScript and QTP context.
This article is the first in a series of Design Patterns articles, which will explore both how traditional Design Patterns manifest themselves in the world of QTP programming, as well as suggest new patterns that are unique to the context of functional automation.
The concept of Design Patterns might be difficult to grasp at first, but I hope that once new articles and examples will be added things will get much clearer. Believe me, Design Patterns are worth you attention.
So go right ahead and read the new article!
Enjoy,
Yaron. Read more:Intoduction
The Singleton - A new Design Patterns Article 2007-11-01 22:58:25 A new Design Patterns
article is now available - The Singleton Pattern!
After we've learned what Design Patterns are in the introduction article, we can now begin our exploration of spcific patterns and their uses. We begin with one of the simplest patterns – the Singleton.
The Gang of Four eloquently summarize the intent of the Singleton pattern as follows: "Ensure a class only has one instance, and provide a global point of access to it". We can illustrate the pattern's concept with an example.
Imagine having a script which accesses a database, or writes data to an external excel file. In order to accomplish these tasks, the script must create and utilize auxiliary objects that connects to the database or the file (e.g. a FileSystemObject, an Excel.Application or an ADO object), and perform various tasks.
If we allow our script to create these objects freely, we risk ending up with extremely inefficient code, or even worse, a script which produces errors and ev Read more:Article