Category Archive: QTips

Apr 12 2008

Display Records

The following example demonstrates how to display all records from a table. and loop thorough a record-set. Dim oConn, oRst, oField Dim sql set oConn = CreateObject(“ADODB.Connection”) oConn.Open “QT_Flight32″ set oRst = CreateObject(“ADODB.recordset”) oRst.Open “Select * from Orders”, oConn Do Until oRst.EOF For each oField in oRst.Fields Print oField.Name & ” = ” & oField.Value …

Continue reading »

Apr 11 2008

Sending an HTML Email from a Pre-Made File

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 …

Continue reading »

Apr 11 2008

Get all Processing on the Local Machine

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

Apr 11 2008

Report Hierarchical Events in QTP Log

Motivation The QTP native log has many drawbacks, especially if your scripts relay heavily on Functions. While Actions are reported in an hierarchical structure (i.e. nested according to their call chain), events reported by function are reported in a flat, unsorted manner. This can be illustrated by the following example: The following QTip will allow …

Continue reading »

Apr 11 2008

Get a WebElement’s Style

While some of a WebElement’s style properties are available via it’s Test-Object properties (e.g. its height, visibility etc.), a lot of its visual styling is left unknown to QTP. This can be overcome via its Runtime .CurrentStyle property. For example, this WebElement is the welcome header of AdvancedQTP’s main page: ‘Grabe the WebElement Set oWebElement …

Continue reading »

Apr 10 2008

Getting the Current Mouse Cursor

Sometimes, you can only tell when an AUT operation has ended by checking the windows mouse cursor – is it an hourglass, or a simple arrow.   The following code allows your to get the integer code of the mouse icon: ‘These come once, in the top of the script extern.Declare micLong,”GetForegroundWindow”,”user32.dll”,”GetForegroundWindow” extern.Declare micLong,”AttachThreadInput”,”user32.dll”,”AttachThreadInput”, micLong, …

Continue reading »

Apr 08 2008

Fast Count Specific Words in a log File

The following example will count the appearance of a word or expression inside a log file. The log file: [1/27/2008 15:6:47] LogFile Open. [***** Search on FAIL/MessageBox keywords for failures *****]. [1/27/2008 15:6:47] Initial thread locale=409 [1/27/2008 15:6:47] returned from France fix with locale 409 [1/27/2008 15:6:47] OC_PREINITIALIZE:[iis] End. Return=1 (OCFLAG_UNICODE) [1/27/2008 15:6:47] OC_INIT_COMPONENT:[iis,(null)] Start. …

Continue reading »

Apr 07 2008

Embedded Screenshot on QTP Report

Almost every test object in QTP supports the method CaptureBitmap even the Desktop object. During your test or within a recovery scenario you want to capture a screenshot of a specific object or the desktop. to later analyze the results. But if you want to find the bmp or png file you need to search …

Continue reading »

Apr 07 2008

Changing License Type

Need to change license type from “concurrent” to “seat” or from “seat” to “concurrent”? Changing to seat license HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\Rainbow “LicType”=dword:00000000 Change to concurrent HKEY_LOCAL_MACHINE\SOFTWARE\Mercury Interactive\QuickTest Professional\Rainbow “LicType”=dword:00000001

Apr 06 2008

Minimize QTP

Sometimes when QTP is running the QTP application is in front of the AUT. and you can’t see what is happening on the AUT. The Solution, is to minimize QTP during run. this function can be placed in a function library file and will be executed every time you run a script. ‘ ** Minimizing …

Continue reading »

Page 5 of 18« First...34567...10...Last »