Login   /   Register
Scripting Techniques

Implementing a GUI Layer with Classes

December 20th, 2008 by Meir Bar-Tal
     3 votes, average: 4 out of 53 votes, average: 4 out of 53 votes, average: 4 out of 53 votes, average: 4 out of 53 votes, average: 4 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.

Complex Dictionary Usage

September 1st, 2008 by daniva
     5 votes, average: 5 out of 55 votes, average: 5 out of 55 votes, average: 5 out of 55 votes, average: 5 out of 55 votes, average: 5 out of 5
Loading ... Loading ...

In this article we are about to see the efficiency of a dictionary when checking or retrieving values from a web-table, For this purpose we have the following table in our AUT.

An Improved Dictionary Object

June 19th, 2008 by Yaron Assa
     4 votes, average: 4.75 out of 54 votes, average: 4.75 out of 54 votes, average: 4.75 out of 54 votes, average: 4.75 out of 54 votes, average: 4.75 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.

Handling Java Arrays

June 19th, 2008 by Yaron Assa
     4 votes, average: 4.75 out of 54 votes, average: 4.75 out of 54 votes, average: 4.75 out of 54 votes, average: 4.75 out of 54 votes, average: 4.75 out of 5
Loading ... Loading ...

Tsachi Nimni reveals undocumented methods for reading and manipulating java arrays inherently in QTP.

Sending mail without a security popup

June 4th, 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 ...

This QTip by Naikaparna demonstrates how to send a EMail without initiating any security popups by using CDO, instead of using outlook.

A Pitfall for Beginners when Working with a Dictionary

April 23rd, 2008 by Meir Bar-Tal
     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 ...

When addressing a non-existing key in a Dictionary object, the add method is invoked by default. The problem is that the Windows Script Host does not inform during runtime that there is a missing key. Moreover, the automatically assigned Empty value may cause trouble to our subsequent code execution.

Get all processing on the local machine

April 11th, 2008 by Yaron Assa
     0 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 5
Loading ... Loading ...

Get all running processing on the local machine:

Dim objWMIService, objProcess, colProcess
Dim strComputer, strList
 
strComputer = “.”
 
Set objWMIService = GetObject(”winmgmts:” _
& “{impersonationLevel=impersonate}!\\” _
& strComputer & “\root\cimv2″)
 
Set colProcess = objWMIService.ExecQuery _
(”Select * from Win32_Process”)
 
For Each objProcess in colProcess
strList = strList & vbCrLf & _
objProcess.Name
Next
 
Print strList

Sending an HTML Email from a Pre-Made File

April 11th, 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 QTip is another variation of Sending an HTML email.
Windows 2000 and Windows XP use CDO messaging as a replacement for CDONTS. Sending email with CDO is a simple task.  First we create a reference to the CDO component:

Set objMessage = CreateObject(”CDO.Message”)

Then fill-in Sender, Subject and Recipient (To) fields of the headers and the […]

Fast count specific words in a log file

April 8th, 2008 by daniva
     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 ...

The following example will count the appearance of a word or expression inside a log file.

Sorting a String Array

April 2nd, 2008 by daniva
     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 ...

Sorting arrays in VBScript has never been easy; that’s because VBScript doesn’t have a sort command of any kind. In turn, that always meant that VBScript were forced to write their own sort routines, be that a bubble sort, a heap sort, a quicksort, or some other type of sorting algorithm.

But that was before the advent of the .NET Framework. If you have the .NET Framework installed on your computer then you can sort an array using code no more complicated than this:

Sorting Arrays - Heap Sort

April 2nd, 2008 by daniva
     0 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 5
Loading ... Loading ...

Heapsort is a comparison-based sorting algorithm, and is part of the selection sort family. Although somewhat slower in practice on most machines than a good
implementation of quicksort, it has the advantage of a worst-case O(n log n) runtime. Heapsort is an in-place algorithm, but is not a stable sort.

Worst Case Array Statistics

April 2nd, 2008 by daniva
     0 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 5
Loading ... Loading ...

Worst case means that the array is already sorted in reverse order from the required. Worst Case Function just loop from max to min to create a sorted array in descending order

Sorting Arrays - Quick Sort

April 2nd, 2008 by daniva
     0 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 5
Loading ... Loading ...

Quicksort in action on a list of random numbers. The horizontal lines are pivot values.Quicksort is a well-known sorting algorithm developed by C. A. R. Hoare
that, on average, makes (big O notation) comparisons to sort n items.

Sort Arrays - Merge Sort

April 2nd, 2008 by daniva
     0 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 5
Loading ... Loading ...

In computer science, merge sort or mergesort is an O(n log n) comparison-based
sorting algorithm. It is stable, meaning that it preserves the input order of equal elements in the sorted output. It is an example of the divide and conquer algorithmic paradigm.
It was invented by John von Neumann in 1945.

Sorting Array - Bubble Sort

April 2nd, 2008 by daniva
     0 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 5
Loading ... Loading ...

Bubble sort is a simple sorting algorithm. It works by repeatedly stepping through the list to be sorted, comparing two items at a time and swapping them if they are in the wrong order.

Dictionary of Employees

April 1st, 2008 by daniva
     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 ...

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 […]

Verify the Existence of a Dictionary Key

April 1st, 2008 by daniva
     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 ...

Demonstration script that verifies the existence of a particular key within a Script Runtime Dictionary. Script must be run on the local computer.

List the Number of Items in a Dictionary

April 1st, 2008 by daniva
     0 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 5
Loading ... Loading ...

Demonstration script that counts the number of key-item pairs in a Script Runtime Dictionary. Script must be run on the local computer.

Delete One Element from a Dictionary

April 1st, 2008 by daniva
     0 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 5
Loading ... Loading ...

Demonstration script that deletes a specific key-item pair from a Script Runtime Dictionary. Script must be run on the local computer.

Delete All Elements from a Dictionary

April 1st, 2008 by daniva
     2 votes, average: 3.5 out of 52 votes, average: 3.5 out of 52 votes, average: 3.5 out of 52 votes, average: 3.5 out of 52 votes, average: 3.5 out of 5
Loading ... Loading ...

Demonstration script that deletes all the key-item pairs from a Script Runtime Dictionary. Script must be run on the local computer

Add Elements to a Dictionary

April 1st, 2008 by daniva
     0 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 5
Loading ... Loading ...

Demonstration script that adds three key-item pairs to a Script Runtime Dictionary. Script must be run on the local computer.

Sending a Text Email with an Attached File

April 1st, 2008 by daniva
     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 ...

Windows 2000 and Windows XP use CDO messaging as a replacement for CDONTS. Sending email with CDO is a simple task.
First we create a reference to the CDO component

Sending an HTML Email

April 1st, 2008 by daniva
     0 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 50 votes, average: 0 out of 5
Loading ... Loading ...

Windows 2000 and Windows XP use CDO messaging as a replacement for CDONTS. Sending email with CDO is a simple task.
First we create a reference to the CDO component

Sending a Text Email

April 1st, 2008 by daniva
     1 votes, average: 1 out of 51 votes, average: 1 out of 51 votes, average: 1 out of 51 votes, average: 1 out of 51 votes, average: 1 out of 5
Loading ... Loading ...

Windows 2000 and Windows XP use CDO messaging as a replacement for CDONTS. Sending email with CDO is a simple task. First we create a reference to the CDO component.