Skip to main content

Posts

Showing posts from August, 2008

Export TestPartner run into xml with xsl

TestPartner run results can be exported using command line, tpexport, or via File|Export from with TestPartner itself. Another way of exporting run results is via TestPartner.TLB automation. The beauty with TestPartner.TLB is that you can export with it the xsl. See below for the code. Option Explicit Sub TestTPResultDump() Dim t As New TPApp Dim pCount As Integer Dim p As Integer Dim sCount As Integer Dim sName As String Dim tp2 As TestPartner.TPProject2 t.Login "admin", "admin", "TestPartner_SQL", 1 pCount = t.Projects.Count For p = 1 To pCount If t.Projects.Item(p).Name = "ScratchProject" Then Debug.Print t.Projects.Item(p).Name Set tp2 = t.Projects.Item(p) Dim rc As Integer For rc = 1 To tp2.Results.Count If tp2.Results.Item(rc).Name = "scratch2" Then Debug.Print tp2.Results.Item(rc).Description ...

Handle popup menus manually in TestPartner

One of the areas where TestPartner 6.1.x is challenged in controlling application under test (AUT) is Popup Menus. It handles it one time but sometimes it complains that the menu is not detected but it is clearly infront of the screen. Though it is working ~80% of the time but Murphy's law has it that if anything can go wrong, it will. What I have come up so far is to handle popup menus manually. See below for the code, so far it seems to meet my needs. Option Explicit Private Declare Function SetCursorPos Lib "user32" _ (ByVal x As Long, ByVal y As Long) As Long Sub Main() 'open Windows Explorer in "My Computer" Window("Desktop Window").Attach ListView("Index=1").Select "CD Drive (E:)", tpMouseRight PopupMenuEx2 "Properties" Window("Application=Explorer.exe Classname='#32770'").Attach Button("Caption=OK").Click End Sub Private Function PopupMen...

Print active application and title using pywinauto

Code snippet below shows how to get the window title and application name of the active application. That is the application on top of the z-order. Need to install pywinauto to get this to work. import pywinauto.application import pywinauto.handleprops as _handleprops import pywinauto.win32functions as _win32functions import time while 1:     hwnd = _win32functions.GetForegroundWindow()     print "Active Window title is %s"%(_handleprops.text(hwnd))     print "Application name is %s"%(pywinauto.application.process_module(_handleprops.processid(hwnd)))     time.sleep(2)    ~ts