Skip to main content

Posts

Showing posts with the label Test Automation

How to provide MSAA Name for MFC edit controls

Microsoft Active Accessibility (MSAA) can be used in GUI test automation or for accessibility. For test automation purposes, IAccessible::get_accName can be used to retrieve name of an edit box. To make this to work for MFC based applications, the tab order sequence should be modified such that the static label at the left of the edit box is one number lower. For example, if the edit box's tab order number is 5, the static label on the left should have tab order of 4. For MFC based application created using VS2010, menu Format | Tab Order (Ctrl + D) should show the order sequence graphically. Note that this is applicable to the following test automation tools/frameworks: - Test Partner - Rational Robot - UI Automation Just to stress this out again, you need to have a static label to the left of the edit box for this work. Enjoy! References: http://msdn.microsoft.com/en-us/library/dd373597(v=VS.85).aspx http://msdn.microsoft.com/en-us/library/dd318483(VS.85).aspx ~ts

COM hooking research

This post is gonna be a work in progress. What I am trying to embark on is the possibility of inserting hooks to a running COM server to perform automated testing. I have seen applications tried to do this, like TestPartner, but it is crashing my application under test. Summary of available tools that may have a working COM server hooks: TestPartner   - they have ComSpy but this is crashing my application under test. COMslicer  - from the help file. COMslicer is a utility that displays information about COM/DCOM components’ activity. It reports all methods and properties called by a client of a COM component and shows values for input/output parameters. COMslicer also reports creation and destroying of COM objects as well as raising events by COM objects. It keeps track of reference counting and interfaces queried by a client. COMslicer works on Windows 98/Me/ NT4/2K. But it seems to me that the development of this tools has halted. A quick visit to their website does not event menti

InstallShield crashing when run from a remote machine using STAF

I have been using STAF/STAX for a while now as a framework on top of software test automation. When we started moving some of our tests in Windows Vista noticed that there have been cases where uninstallation of the software under test is crashing. I thought it was some component not playing well with Windows Vista but I when I tried to perform the uninstallation sequence manually everything was fine and dandy. So I started digging around and I found out that in Windows Vista, the following command may fail. C:\>staf remotemachine process start command "C:\PROGRA~1\COMMON~1\INSTAL~1\Driver\1150\INTEL3~1\IDriver.exe /M^{1CD6500F-DE1E-44AC-A279-4C85247A9A85^}" Poking around even more and I finally found a workaround, to get the above command working in Vista, do: C:\>staf remotemachine process start shell command "C:\PROGRA~1\COMMON~1\INSTAL~1\Driver\1150\INTEL3~1\IDriver.exe /M^{1CD6500F-DE1E-44AC-A279-4C85247A9A85^}" Notice the use of shell to ma

Controlling Popup menu using Accessibility API

In my previous post I discussed about using Accessibility API to control Windows Start Menu. For this blogpost exercise we will control a popup menu using AA. For those who are familiar with VBA, they would know outright that class modules cannot use AddressOf operator within the class definition. In the spirit of Object Oriented programming, it would have been better to use solely class module for this but due to AddressOf requirements that it should be in a module then we will try to mix and match using both Class module and a module. The code is not a elegant as I hope it would be but this is the way VBA was designed. Now let us get our hands dirty, first we will create a class module named CPopupMenuController. This is a very simple class module, in the initialization section we set a hook to receive focus events coming from the system and remove the hook once the object is destroyed. See below for the code: '--------------------------------------------------------------

Start Menu handler using Accessibility API

The code below demonstrates how to run an application from Start menu using accessibility API in TestPartner making use of VBA. For this exercise, we will use Test Script, Class Module and Module. The original intent was to have the functionality built into class module and instantiate it in Test Script. But AddressOf operator does not work inside a class module in VBA hence using Module. Anyway, first let us define the class module. For this exercise name it CStartMenuController. See below for the code (save this as CStartMenuController): '------------------------------------------------------------------------------ ' Develop by : Techno.Scavenger ' Licensed to : Mankind ' Date : 26Oct2008 @ 1:39 AM + 8 GMT (Sunday @home) ' Warranty ' THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMEN

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