Highlight an object or window using QTP

To highlight an object or window manually or programmatically (from within the script)

Manually

Object Repository window. Available also in the Object Repository Manager for shared object repositories:
1. Open the Object Repository

2. Select desired object to highlight

3. Go to "View" menu

4. Select "Highlight in application" option

5. See results:
◦ Succesful: Blinking gray rectangle surrounding the object

◦ Failed: A pop-up window with an error or warning.

Object Spy. Available in QuickTest Professional 11.00, Unified Functional Testing 11.5 and later):
1. Open the Object Spy dialog

2. Click on the spy button

3. Click/Select desired object or child of desired object

4. Select desired object from the Hierarchical tree pane

5. Click the "Highlight in application" option, next to "Spy" button

6. See results (Exact same as when using similar option from Object Repository section above)

Programmatically

Call/Invoke/Use the hidden/undocumented programmatic Highlight method.

Object(description).highlight

Where "Object" is a Test Object class.

description – The logical name or a descriptive programming description of the object or window to be highlighted.

Example:

Browser("Netscape.com").highlight
wait 1
Browser("Netscape.com").Page("Netscape.com").Link("Breaking News:").highlight
wait 1
Browser("Netscape.com").Page("Netscape.com").Image("Get Quote").highlight

‘ or

Window("Notepad").WinEditor("Edit").highlight
wait 1
Window("Notepad").highlight
wait 1

Advertisements

Download run results files from ALM using OTA

This can be done using the ExtendedStorage property of the Run object.

Note: it works for both normal tests and BPT tests

RunID = 433
downloadPath = “C:\Temp”
qcurl = “http://10.10.14.15/qcbin
qcdomain = “DEFAULT”
qcproject = “DemoProject”
qcuser = “admin”
qcpass = “”

if IsOTAInstalled() then
set QCConnection = CreateObject(“TDApiOle80.TDConnection”)
QCConnection.InitConnectionEx qcurl
QCConnection.ConnectProjectEx qcdomain, qcproject, qcuser, qcpass
If not QCConnection.Connected then
Msgbox “Not connected. Exiting…”
Wscript.Quit
else
Set auxFilter = tdc.RunFactory.Filter
auxFilter.Filter(“RN_RUN_ID”) = RunID
For Each auxRun In auxFilter.newlist
Set extStorage = auxRun.ExtendedStorage
extStorage.ClientPath = downloadPath & “\” & RunID
extStorage.Load “”, true
Next
QCConnection.Disconnect
QCConnection.Logout
QCConnection.ReleaseConnection
End if
else
Msgbox “OTAClient.dll not registered. Exiting…”
End if
Function IsOTAInstalled()
IsOTAInstalled = true
On Error Resume Next
set QCConnection = CreateObject(“TDApiOle80.TDConnection”)
if err.number <> 0 then IsOTAInstalled = false
On error goto 0
End Function